code/await methods

14 views
Skip to first unread message

Luke Whittlesey

unread,
Feb 13, 2020, 4:18:12 PM2/13/20
to ceu-...@googlegroups.com
Hello,
I've been looking at methods as described in the manual [1].

````
code/await My_Code (var int x) -> (var int y) -> NEVER do
y = x; // "y" is a public field

code/call Get_X (none) -> int do // "Get_X" is a public method
escape outer.x;
end

code/await Test (none) -> int do // is this possible?
await 1s;
escape 1;
end

await FOREVER;
end

var& My_Code c = spawn My_Code(10);
var int x = call c.Get_X();
_printf("y=%d, x=%d\n", c.y, x); // prints "y=10, x=10"
````
The example works as described with c.Get_X() (code/call), but is it
possible to use code/await as a method?
I get a compiler error 'not implemented' with `await c.Test();`

It's fine if this is not supported, but I thought I should ask just in
case I have the syntax wrong.

Thanks!

[1] https://ceu-lang.github.io/ceu/out/manual/v0.30/statements/#code-references

Francisco Sant'anna

unread,
Feb 13, 2020, 7:46:19 PM2/13/20
to ceu-...@googlegroups.com
On Thu, Feb 13, 2020 at 6:18 PM Luke Whittlesey
<luke.wh...@gmail.com> wrote:
> var& My_Code c = spawn My_Code(10);
> var int x = call c.Get_X();
> _printf("y=%d, x=%d\n", c.y, x); // prints "y=10, x=10"
> ````
> The example works as described with c.Get_X() (code/call), but is it
> possible to use code/await as a method?
> I get a compiler error 'not implemented' with `await c.Test();`
>
> It's fine if this is not supported, but I thought I should ask just in
> case I have the syntax wrong.

The syntax is correct, but it's not currently implemented.
Reply all
Reply to author
Forward
0 new messages