From: Minero Aoki Date: 2002-07-01T19:00:38+09:00 Subject: ruby-dev summary 17541-17608 Hi all, This is a summary of ruby-dev ML in these days. ruby-dev summary 17541-17608 (2002-06-22 ... 2002-06-27) [ruby-dev:17421] broken string when unterminated "#{". -- From last article -- In current ruby, "#{"abc"}" is parsed as '"abc"', not '"#{" abc "}"'. Is this behavior smart or bad? Tanaka Akira claimed that the notation of string became a kind of 'control structure' and it is better that we can write Ruby's code in #{} without any escaping. Matz agreed his opinion. -- This week -- Nobuyoshi Nakada has implemented "control structure #{...} block". But at the same time it breaks backward compatibility. For example: "...#{\"string\"}..." # escape causes a syntax error. "...#{some code # comment}..." # comment shadows closing quote; # causes a syntax error. We must choose either powerful new function or backward compatibility. [to be continued] [ruby-dev:17548] Ruby grammer TANAKA Akira has suggested clarifying the syntax of Ruby. The first topics are: * omission of method call parentheses e.g. print("hello") -> print "hello" * precedence of blocks Principles noted by matz: * method-calls without parentheses cannot be nested (?) # not acceptable (?) method method method var * do...end block associates with the most-left method call. m m() do .... end -> m(m()) do .... end m ident do .... end -> m(ident) do .... end # `ident' is var_ref (lvar or method) * {...} block associates with the most-right identifier. m m() { .... } -> m(m() { .... })) m ident { .... } -> m(ident() { .... })) # `ident' becomes method call. * Blocks can be chained. # acceptable m {....}.m {....}.m {....} m do....end.m do....end.m do....end * Blocks cannot be nested. # not acceptable m {....} {....} m {....} do....end [ruby-dev:17594] %w(... #{...} ...) Nobuyoshi Nakada has suggested a new literal-embedded expression like this: %W(word word str#{....} word) Example: var = 1 %W( word word #{var}str word ) # ['word','word','1str','word'] This idea is accepted.