Re: [Felix-language] [felix] Re: Objects in Felix

2012-05-19 Thread john skaller
On 20/05/2012, at 12:16 PM, Raoul Duke wrote: >> The right way to do it is to do the static typing first. Then provide >> flexible but statically typed constructions. The more flexible you make >> them the more closely it resembles dynamic typing, but now we have >> a range of alternatives. > > w

Re: [Felix-language] [felix] Re: Objects in Felix

2012-05-19 Thread Raoul Duke
On Sat, May 19, 2012 at 12:32 AM, john skaller wrote: > We'll get to that. Felix was always meant to be dynamically typed. > It is a scripting language after all. However, the way forward I have > chosen is: instead of "Python is dynamically typed lets try (in vain) to > add optional static typing

[Felix-language] Objects in Felix: Value extensions

2012-05-19 Thread john skaller
On 19/05/2012, at 8:27 PM, john skaller wrote: > var xyz:XYZ = extend x,y with (k="world") end; Ok, so I now think: the first stage in making the Java like syntax for objects with extensions is anonymous objects: var o = object (arguments) implements X = { omethod ...

[Felix-language] Amusing facts

2012-05-19 Thread john skaller
Just thought to throw some info in here for no reason. The way Felix implements closures is non-obvious and not efficient for a subtle reason. When you do this: fun f(x:int)=>x; var g = f; println$ g1; Felix create an object of C++ class f on the heap, and stores a pointer to it in variable g. I

Re: [Felix-language] Objects in Felix: Value extensions

2012-05-19 Thread john skaller
A more complete example: // var x = (a=1, b=2, c="m"); var y = (c=9.9, s="Hello"); typedef X = (a:int, b:int, c:string); typedef Y = (c:double, s:string); typedef XYZ = extend X, Y with (k:string) end; var xyz:XYZ = extend x,y with (k="world") end; println$ xyz.a, xyz.b, xyz.c, xyz.s, xyz.k

Re: [Felix-language] Objects in Felix: Value extensions

2012-05-19 Thread john skaller
On 19/05/2012, at 7:53 PM, john skaller wrote: > I've now implemented value extensions. The syntax is temporary > just to get stuff working. > > / > var x = (a=1, b=2); > var y = (c=9.9, s="Hello"); > > var xyz = extend x,y with (k="world") end; > > println$ xyz.a, xyz.b, xyz.c, xyz.s, xyz

[Felix-language] Objects in Felix: Value extensions

2012-05-19 Thread john skaller
I've now implemented value extensions. The syntax is temporary just to get stuff working. / var x = (a=1, b=2); var y = (c=9.9, s="Hello"); var xyz = extend x,y with (k="world") end; println$ xyz.a, xyz.b, xyz.c, xyz.s, xyz.k; Note syntactic quirkology: x,y means value x, then value y

Re: [Felix-language] [felix] Re: Objects in Felix

2012-05-19 Thread john skaller
On 19/05/2012, at 4:44 PM, john skaller wrote: > > At the moment you have to do this: > > typedef ab = (a:int, bint); > p (z :>> ab); > > i.e. you have to explicitly coerce the record to have the exact fields the > function requires. Ah, I should add some comments on "polymorphism" here, mea