m.invoke() vs. m()
neal at gafter.com
Sat Dec 5 09:03:48 PST 2009
On Sat, Dec 5, 2009 at 4:33 AM, <tronicek at fit.cvut.cz> wrote:
> I noticed a discussion about m.invoke() and m() on Mark Reinhold's blog
> and although it is true that if m is in the variable name space, we need
> "invoke", if syntax
> fun void m(int x);
> is adopted, it seems natural to have m in the method name space and then
> the "invoke" is not needed.
I think Mark's idea is workable whatever he syntax. We had this in version
0.1 of the BGGA spec. We backed it out not because we thought it a bad
idea, we just preferred to focus our attention on the other issues.
The basic approach is to say that a variable of function type is in both the
variable and the method namespaces. It is a bit funny to make the function
interfaces special in this way, but I think it is sensible. You need to
carefully define what it means to be "of function type" (e.g. does it
include a variable of a type derived from a function type), and you need a
whole bunch of additional rules (e.g. a variable of function type can't
hide/override a method, etc) but I think it's all workable. It adds a
moderate amount of complexity to the specification, but (like most of BGGA)
that complexity is rarely surfaced to the developer.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the closures-dev