#90 Dynamic Calls

brian Mon 26 Jun 2006

Andy and I agreed to the following design for the dynamic call feature:

a->x        a.trap("x", [,])
a->x = b    a.trap("x", [b])
a->x()      a.trap("x", [,])
a->x(b)     a.trap("x", [b])
a->x(b, c)  a.trap("x", [b, c])

Dynamic calls is really a pretty basic feature. The "->" operator is compiled into a virtual call to Obj.trap(Str, Obj[]). Perhaps the only tricky issue is that a "dynamic set" routes to a trap with the rhs passed as a parameter - but this is consistent with how setters are auto-generated for fields. The default implementation of Obj.trap() will use route to a field access or method call via reflection.

brian Tue 27 Jun 2006

This is done and checked in

Login or Signup to reply.