From: Yukihiro Matsumoto Date: 2005-08-05T10:09:41+09:00 Subject: Re: new block notation (was: Re: ruby-dev summary 26468-26661) Hi, In message "Re: new block notation (was: Re: ruby-dev summary 26468-26661)" on Fri, 5 Aug 2005 09:49:28 +0900, Florian Gro� writes: |Is it really in accordance to Ruby's design mentality to introduce new |syntax just because parsing the most obvious one is too complex? I didn't choose -> syntax just because "the most obvious one is too complex". Block parameters are destination of multiple assignment. It was natural since it was designed to be loop variables. Later on, closures were introduced. Closure, or function object has different requirement for their parameters. * loop variables requires no strict check, it is OK to ignore given value in the loop body. But method does strict check. I think closures as well. * since block parameters are multiple assignment, it does have some weird behavior in corner cases, especially when arrays and values associated in left hand expression. In short, their have been some big (well, at least for me) semantic gap in block parameters since closures come into the language. This is a good chance to fix. |I also think that you might be able to fix the arrow syntax by moving |it. I think something like this is acceptable: | |adder = (a, b) -> { a + b } Again, I don't think yacc would allow this. |This is again very hard to parse. Perhaps even for humans. So: | |adder = \(a, b) -> { a + b } |printer = \a -> { puts a } I don't want to use backslashes just for yen-sign problem, besides this particular idea requires even more punctuation. It is an unfortunate character (at least in Japan) which has totally different appearance between fontset. For example, '\' above can be seen as a backslash on my Emacs, yen-sign on my browser, only if the page contains any Japanese characters. That might be my personal problem, but I consider myself very important in the design process of the Ruby language. matz.