2 Dec 2007 00:25
Re: [groovy-user] Style preference.
On Sat, 2007-12-01 at 14:39 -0600, Charles Oliver Nutter wrote: > Ruby does not warn for a space before the parens in a method definition. > It warns for a space before the parens in a method invocation: > > foo (a, b) That is true. The question is why? > Because it's making a guess that you meant foo(a, b) and are not using > (a, b) for a multiple assignment somewhere. Ruby has much more extensive > multiple assignment capabilities, so I think the warning is a good one > to have. Sorry but this sounds like doublethink -- compilers should not be guessing, either the expression is a function call or it is not. In all cases I have ever come across, the Ruby compiler recognizes such an expression as a function call, so what is the point of announcing that the definition of Ruby does not allow a space after the function name in a function call when actually it doesn't matter. Is it that the Ruby grammar is ambiguous? > (a, (b, c))) = [1, [2, 3]] Apologies but what is this demonstrating? This is a perfectly valid statement in either Python or Ruby -- but sadly not yet in Groovy. > You can certainly silence it if you like. How? I still don't see why f(x), f(x ), f( x), and f( x ) are function calls but f (x), f (x ), f ( x), and f ( x ) are not except by guesswork on the part of the compiler. Either space is significant (in which case I will not use the language) or it is not. -- -- Russel. ==================================================== Dr Russel Winder Partner Concertant LLP t: +44 20 7193 9203 41 Buckmaster Road, f: +44 8700 516 084 London SW11 1EN, UK. m: +44 7770 465 077
RSS Feed