You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With V0.6.8 as the current C3 release, I am working my way through the C3-tutorial. No problems in the "Basics" section. But under "More", the Namedarguments example reads :
On reading the reference, I first replaced that statement with : test(y: 3.0, x: 1) but then got another compiler error: named arg's must be in order ... which I corrected, now it runs fine. So no big deal (it's the curse of documenting), but still it's rather confusing ...
The text was updated successfully, but these errors were encountered:
Additional info : what I observe is not a bug in the C3-compiler, but a divergence between the current state of C3 and your interactive C3-tutorial. Specifically:
Now in your local v0.6.8 install of c3c : copy the source into a file, and compile it: then I get the following console output:
===========================================================================
herman@D830:~/c3-tutorial$ c3c compile namedargs_erroneous.c3
7:
8: fn void main()
9: {
10: test(.y = 3.0, .x = 1);
^
(/home/herman/c3-tutorial/namedargs_erroneous.c3:10:7) Error: An expression was expected.
===========================================================================
The compiler errors go away when I change two things:
a) test(y: 3.0, x: 1); => now the compiler complains that I need to give the named args in order
b) test(x: 1, y: 3.0); Ok
So this C3-tutorial example is clearly out of sync with the current state C3 ... and a noob like me gets confused ...
With V0.6.8 as the current C3 release, I am working my way through the C3-tutorial. No problems in the "Basics" section. But under "More", the Namedarguments example reads :
import std::io;
fn void test(int x, double y)
{
io::printfn("%f", x + y);
}
fn void main()
{
test(.y = 3.0, .x = 1); => compiler error : expected an expression
test(3, 4.0);
test(15, .y = 3.141592);
}
On reading the reference, I first replaced that statement with : test(y: 3.0, x: 1) but then got another compiler error: named arg's must be in order ... which I corrected, now it runs fine. So no big deal (it's the curse of documenting), but still it's rather confusing ...
The text was updated successfully, but these errors were encountered: