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 ...
                omethod ...
        };


Note that the "implements X" has now been made optional.
If you give it, the compiler can type check it, otherwise the
type is deduced (since it is just a function!).

It's not clear how useful the (arguments) are to an anonymous object,
since you would have to apply it (since its a function) just as you would
for a lambda (anonymous function).

So once we have anonymous objects we can immediate use the

        extend x, y, z with (object (arguments) = { 
                omethod ...
        }) (args) end

syntax .. as a special case when there's no arguments

        extend x, y, z with object  {...} end

and thence it's pretty clear:

        object derived (arguments) extends x,y,z {
                omethod ...
        }

is just sugar for the alternate value extension syntax + anonymous objects,
and we're back to something that looks like Java .. except instead of classes
we have objects.

It's not entirely clear this is right because the objects being extended are
just that: they're current values of variables NOT functions, whereas the 
extension
is actually a function.

Instead, we probably want functions, so:

        object derived (arguments) extends X(args), Y(args), Z(args) { ... }

where the args to the X, Y, Z are whatever you want, usually coming from
the arguments to derived. The implementation would then nest

        var x = X(args); var y= Y(args); var z=(args);
        ...

and return the record given by

        extend x,y,z with (meth1=meth1, .... )

So this looks like the plan at the moment, though a spider may
jump up and bite me in the bum whilst implementing it..
It can be done in Scheme alone (in the grammar) I think but
I'm not a very good Scheme programmer.

Anyone know any Scheme gurus?

--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to