On Thu, Jun 03, 2004 at 07:07:17PM +0900, David Garamond wrote: > Paul Brannan wrote: > >>[ruby-dev:23572] keyword argments (Ruby2.0 spec) > >> > >> Nagai asked how keyword arguments and hash-style arguments work in > >> ruby-2.0, since a lot of hash-style arguments appear in his extension > >> library 'Ruby/Tk'. Matz proposed following two solutions. > >> (a) hash-style argument appearing at the end of argument list is > >> supported as usual. > >> (b) hash-style arguments were abolished. > > > > > >I'd prefer (a), because backward-compatibility is a good thing, and I'd > >prefer to change my code as little as possible to make it work on Ruby > >2.0. > > But I suspect there will be lots of changes needed for Ruby 1.x source > to work with Ruby2. For instance, as I understand, the syntax for hash > literal will become: > > {'foo': 1, 'bar': 2} > > where in Ruby1.x it's: > > {'foo', 1, 'bar', 2} > {'foo' => 1, 'bar' => 2} > > I suspect Ruby2 will forbid the latter? No, both will work. {a: 1} in Ruby >= 1.9 is just a short form for {:a => 1} or at least that's how I understood it. Regards, Michael