On 14/11/2012, at 7:24 PM, john skaller wrote:
> 
> So what I think we need to "fool"** Java programmers into thinking we
> have OO is a simple syntax for method delegation. Any suggestions
> how to encode the above technique in a slightly nicer syntax?


OMG. Its already implemented!

object joe[T] (x:list[T]) extends fred x as var y implements B[T] = {
  method proc pprint () { print "Hello "; y.print(); }
}

This "just works"!!

Note the expression:

        fred x as var y

The "var" bit there is new. This assigns a name (an variable)
to the expression "fred x", *inline* i.e. from inside an expression.
I checked, it doesn't escape to global scope in this case either.

We need the name to implement pprint.

Even MORE magical ..

object joe[T] (x:list[T]) extends fred x as var y implements B[T] = {
  method proc pprint () { print "Hello "; y.print(); }
  method proc print () { print "OVERRIDE "; y.print(); }
}

This *just works* too. 

I'm not going to even bother checking that this construction
can do multiple inheritance because I KNOW it can 
(just from the grammar!)

[CRAP! I should learn my own language!]

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




------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to