On Tue, 20 Jan 2009 11:58:46 -0700, Joe Strout wrote: > Aaron Brady wrote: > >> I think it would be a good step if you could make some sensible >> interpretation of a typical statement without its parentheses. >> >> f "abc" 123 >> --> >> f( "abc", 123 ) >> >> It would be just the thing in a couple of situations... > > Such a language is possible -- take a look at REALbasic sometime. RB > certainly has its problems (mainly bugs), but the language syntax is > beautiful. To your point, parentheses are not required around any > method call that (1) has no return value, or (2) requires no parameters. > Example: > > LogError "Walk has gotten too silly", CurrentTime > > Here, LogError is a method call that takes two arguments, and > CurrentTime is a method call that takes none.
That seems ambiguous to me. As a non-RealBasic programmer, I can see at least four meanings it could have. Translated into Python, they are: LogError("Walk has gotten too silly", CurrentTime) LogError("Walk has gotten too silly"), CurrentTime LogError("Walk has gotten too silly", CurrentTime()) LogError("Walk has gotten too silly"), CurrentTime() Of course this assumes that RealBasic has an equivalent of tuples, and treats functions as first class objects. But even if RB doesn't have these things, I question that the syntax is "beautiful". Consider some arbitrary method Foo. If you see this: Foo Is that legal RB syntax? Maybe yes, maybe no. It all depends on what Foo does. If it returns no result, then it's legal. If it returns a result, it isn't. So the question of whether syntax is legal depends, not on the syntactic elements involved, but on the *semantics* of the method (whether or not it returns a result). > Eliminating unnecessary parentheses does a lot to improve the > readability of the code IMHO. But they're not unnecessary, at least not in Python, they're useful for distinguishing between calling the function and the function itself. -- Steven -- http://mail.python.org/mailman/listinfo/python-list