On 18/05/2012, at 3:47 AM, Raoul Duke wrote: > otherwise known as structural typing?
Well we could say interface Fred { getx: 1 -> int; }; interface Joe extends Fred { gety: 1 -> int; } and it looks like Java ... :) But it's actually just a typedef for a record type :) And we might have object X implements Fred { ctor (x:int, y:int) {} method fun getx () => x; method fun gety() => X; } which is just fun X(xint, y:int):Fred = { fun get x() => x; fun get y() => y; return { getx = getx, gety=gety); } With that idea, we could implement Java in Felix entirely in the grammar using Scheme as a macro processor. The resulting objects: (a) would dispatch faster than Java of C++ (b) would use more storage. (a) is because they're already bound to the object. (b) is because instead of a single vtable pointer, each object has a pointer to *every* function, which has a pointer to the object. So instead of space 1, it has space > 2N. The upside is, you can make objects and declare interfaces *after* the objects are created, saving 2^N interfaces. If you did that in Java or C++ the compiler would die and you'd use a LOT more memory at run time. Note this technology also gives you "multi-methods" for free. No one said using a function was the only way to create a record of functions, that is, no one said all the methods had to bind to a single piece of data (such as a function stack frame). Also quite fun, a dynamic version of it with a string dictionary.. (JudySL) and then we have Python :) -- 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