Backport #1183
closed
Adding support for the new hash literal syntax
Added by knu (Akinori MUSHA) almost 16 years ago.
Updated over 13 years ago.
Description
=begin
Attached is a patch for ruby_1_8 which adds support for the new literal syntax for hash and hash style arguments.
However, there needs some more work to retain the use of colon in place of then/do, in order to keep backward compatibility, although it has been deprecated and dropped in 1.9.
knu@daemon[1]% ruby-1.8.7 -ve 'if true: p(1); end'
ruby 1.8.7 (2008-11-11 patchlevel 73) [x86_64-freebsd7]
1
knu@daemon[1]% ruby-1.8 -ve 'if true: p(1); end'
ruby 1.8.7p5000 (2009-02-19 revision 22433) [x86_64-freebsd7]
-e:1: syntax error, unexpected tLABEL
if true: p(1); end
^
-e:1: syntax error, unexpected kEND, expecting $end
=end
Files
=begin
Hi,
At Fri, 20 Feb 2009 19:17:10 +0900,
Akinori MUSHA wrote in [ruby-core:22286]:
However, there needs some more work to retain the use of
colon in place of then/do, in order to keep backward
compatibility, although it has been deprecated and dropped in
1.9.
No such syntax has been defined officially.
No backward compatibility issue.
--
Nobu Nakada
=end
=begin
Nobuyoshi Nakada wrote:
Hi,
At Fri, 20 Feb 2009 19:17:10 +0900,
Akinori MUSHA wrote in [ruby-core:22286]:
However, there needs some more work to retain the use of
colon in place of then/do, in order to keep backward
compatibility, although it has been deprecated and dropped in
1.9.
No such syntax has been defined officially.
No backward compatibility issue.
What do you mean here in "official"? because AFAIK there has been no single
line of official syntax definitions so far.
=end
=begin
Nobuyoshi Nakada wrote:
Hi,
At Fri, 20 Feb 2009 20:49:35 +0900,
Urabe Shyouhei wrote in [ruby-core:22289]:
What do you mean here in "official"? because AFAIK there has been no single
line of official syntax definitions so far.
Matz's book and official tutorial[1] mention about "then" but
not ":". Is there any description about such colons?
At least O'Reilly's "Programming Language Ruby" has a detailed description
about it. One of a Matz's book no wonder.
=end
=begin
太古のメールに返信する上に-devに振るのですが、これできた気がします。test-allと
かが一応通っていそうです。どんなもんでしょうか。
patchはredmineに貼ってあります。
Akinori MUSHA さんは書きました:
Backport #1183: Adding support for the new hash literal syntax
http://redmine.ruby-lang.org/issues/show/1183
Author: Akinori MUSHA
Status: Open, Priority: Normal
Assigned to: Akinori MUSHA, Category: core, Target version: Ruby 1.8.8
Attached is a patch for ruby_1_8 which adds support for the new literal syntax for hash and hash style arguments.
However, there needs some more work to retain the use of colon in place of then/do, in order to keep backward compatibility, although it has been deprecated and dropped in 1.9.
knu@daemon[1]% ruby-1.8.7 -ve 'if true: p(1); end'
ruby 1.8.7 (2008-11-11 patchlevel 73) [x86_64-freebsd7]
1
knu@daemon[1]% ruby-1.8 -ve 'if true: p(1); end'
ruby 1.8.7p5000 (2009-02-19 revision 22433) [x86_64-freebsd7]
-e:1: syntax error, unexpected tLABEL
if true: p(1); end
^
-e:1: syntax error, unexpected kEND, expecting $end
http://redmine.ruby-lang.org
=end
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
Applied in changeset r24338.
=end
=begin
Shyouhei Urabe さんは書きました:
Applied in changeset r24338.
とりあえずNEWSは書きましたが、テストはどこに突っ込めばいいんでしょうか...
Attachment: signature.asc
=end
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0Like0Like0Like0