m.invoke() vs. m()

Reinier Zwitserloot reinier at zwitserloot.com
Sat Dec 5 11:45:02 PST 2009


On Sat, Dec 5, 2009 at 8:31 PM, Vladimir Kirichenko <
vladimir.kirichenko at gmail.com>
>
> You're saying all the languages dealing with closures without any kind
> of "invoke" made by aliens?
>
>
What kind of comment is that?

No, of course not. Java's choice of separate namespaces for methods and
variables is relatively rare. Python, Ruby, and javascript, for example, all
don't have this. And they all invoke 'closures' by just tagging any variable
name with parentheses. Java isn't these languages. All the problems I posted
are pretty much unique to a language that has separated these namespaces.


> Yes it is. Why don't we use this syntax to invoke regular methods? It is
> a _function call_.
>
>
No it isn't. It's a closure invocation. Which is something you do to
variables, not methods. Variables have a different namespace in java from
methods. I also reiterate my point that everyone has a feel for style and
gut instinct. Your woolly comments about how it feels like  function call
are irrelevant. They aren't the exact same thing, which is all that matters
insofar as gut feeling goes.

Show me either how we can leave off 'invoke' without a sizable set of
changes to the JLS, or how the burden of typing ".invoke" is sufficiently
heavy for it to be worth abolishing even with the serious repercussions I
showed in my previous post. I'm not at all interested in your style
sensitivities.

[snip: List of languages with examples]
>

Java isn't any of those languages. Fortunately the folks who make the
eventual decision on this (Mark Reinhold and crew) strongly dislike this
kind of "Hey, look at language Y, we can just copy what they do" thinking.
Your list of examples is an excellent case in point: All those languages DO
NOT have multiple namespaces for the constructs that you posted. For
example, in C#, friends that program in that language tell me you can't have
a method named 'Foo' and a field also named 'Foo', which is collaborated by
your example. So, for those languages, _duh_. Java isn't C#.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/closures-dev/attachments/20091205/dda719e8/attachment.html 


More information about the closures-dev mailing list