Skip to content

Commit

Permalink
Fix "any" examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
lerno committed Aug 17, 2024
1 parent 857225e commit 07e5c0a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/content/docs/references/docs/anyinterfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ For example, this would make a copy of the data and place it in the variable `an

void* data = malloc(a.type.sizeof);
mem::copy(data, a.ptr, a.type.sizeof);
any* any_copy = any_make(data, a.type);
any any_copy = any_make(data, a.type);

## Variable argument functions with implicit `any`

Expand Down
6 changes: 3 additions & 3 deletions src/content/docs/references/docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -651,9 +651,9 @@ fn String Bob.myname(Bob*) @dynamic { return "I am Bob!"; }
// Ad hoc implementation
fn String int.myname(int*) @dynamic { return "I am int!"; }
fn void whoareyou(any* a)
fn void whoareyou(any a)
{
MyName* b = (MyName*)a;
MyName b = (MyName)a;
if (!&b.myname)
{
io::printn("I don't know who I am.");
Expand All @@ -668,7 +668,7 @@ fn void main()
double d = 1.0;
Bob bob;
any* a = &i;
any a = &i;
whoareyou(a);
a = &d;
whoareyou(a);
Expand Down

0 comments on commit 07e5c0a

Please sign in to comment.