Ok, so this now works:
//////
struct X {
a:int;
b:double;
fun f (x:int) => self.a + x + x;
fun g => self.a;
proc s (x:int) => self.a = x;
};
println "Blah";
var x : X = X (1,2.0);
println$ x.a, x.b, f x 42, g x;
println$ x.a, x.b, x.f 42, x.g;
&x.s 5;
println$ x.a, x.b, x.f 42, x.g;
/////
For some weird reason I decided to use a ref for a procedure
instead of a val of pointer type. Therefore the set procedure s
above is written
self.a = x
rather than
self.a <- x
You would have to do:
&self.a <- x
However, you still have to take the address
&x.s 5;
since "ref" is syntax hack, we don't have real C++ style references
(deliberately!!!!!)
Note I changed the precedence of & a while back so it binds very
tightly now. So &x.f means (&x).s and not &(x.s) as it might in C.
Just got sick of the brackets :)
Now for you fun .. this works...
proc weird => println$ "Helio";
weird;
i mean, no arguments to the procedure AND using the => notation
instead of the { } notation. Dang .. I wrote the compiler and designed
the grammar and I didn't know you could do it :)
--
john skaller
[email protected]
http://felix-lang.org
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language