<[EMAIL PROTECTED]> wrote: > But I think in some situations Ruby allows to omit them, solving some > of the "impossibile" problems shown in this thread. This makes Ruby a > bit better than Python to create application-specific mini languages, > that are quite useful in some situations.
Yes. However, Ruby parser has to resort to heuristic in many cases: <http://www.rubycentral.com/book/language.html> "When Ruby sees a name such as ``a'' in an expression, it needs to determine if it is a local variable reference or a call to a method with no parameters. To decide which is the case, Ruby uses a heuristic." In fact it is something I don't really like about Ruby (even though I find it useful in some cases). This is a 'pathological example' def a print "Function 'a' called\n" 99 end for i in 1..2 if i == 2 print "a=", a, "\n" else a = 1 print "a=", a, "\n" end end But I have to say that omitting brackets in a language such as Python or Ruby can make the code very hardly readable. The interpreter isn't the only one who has to resort to heuristic: everytime you read a name with no parenthesis you may have to go back and see whether it is a bound variable, a method (so you may have to check documentation for various modules) or an 'invalid' variable you forgot to initialize. In fact, when I'm reading code from a project I'm not familiar with, it can be quite hard in the first place. In fact most Rubyists advice to use parentheses (unless you want to achieve a DSL like effect, or in very simple cases like puts s ) The third problem I found out is related to blocks ({} and do have different precedence order). They are only syntax errors, but I find them annoying. -- blog: http://www.akropolix.net/rik0/blogs | Uccidete i filosofi, site: http://www.akropolix.net/rik0/ | tenetevi riso e forum: http://www.akropolix.net/forum/ | bacchette per voi. -- http://mail.python.org/mailman/listinfo/python-list