Really? Perl was Ruby's inspiration??
One of them. There's a bit of this and that, but overall
it seems a bit more Perlish than Pythonish. I've never
gotten a satisfactory answer about how it's "more
object-oriented" than Python, unless they mean that
it uses methods instead of built-in functions.
Seems so. OTTOMH I guess you could have the tokenizer generate two kinds of names,
names_as_now, and bare_names (tagged so with lookahead determining no trailers).
Then you could dynamically check if a bare_name was referring to a callable, and
call it with no params if so, and for all other name usage do as now. Except that as
you point out, you'd need a way to inhibit the effect. But since this thing would be
unusual (and would cause major breakage), maybe it could be enabled only for references
to objects with an __autocall__ alias to their __call__ attribute. And then, since the
auto-call would only happen for bare names, you could pass it as a function by using
name.__call__ instead of name. Or use vars()['name'].
I think that's getting a bit baroque. In fact, after my previous post,
I realized that I had an unnecessary complexity: it's simpler to just
auto-execute "all" functions, and let the ones that require parameters
and don't have them fail like they do today, rather than try to make
a distinction.
It puts the VM through quite a few less hoops: all that really has to
be done is duplicate the various opcodes that can fetch a function
object, so that one of each pair autoexecutes and the other doesn't.
Then the parser can decide which to generate based on whether there
is a parameter list following, and also on whether the "magic" syntax for
retreiving the function object without auto-executing it is present.
I suspect it's also easier to explain: funtions and methods are what
are declared with def and lambda, and if it's not that, then it's not
going to autoexecute regardless of whether it has a __call__ method.
Adding classes to the list might be useful as well, but anything more
would lead, I suspect, to too much confusion.
It's still a non-starter, though
John Roth