Backport #1183
closedAdding support for the new hash literal syntax
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
Updated by nobu (Nobuyoshi Nakada) over 15 years ago
=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
Updated by shyouhei (Shyouhei Urabe) over 15 years ago
=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
Updated by nobu (Nobuyoshi Nakada) over 15 years ago
=begin
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?
[1] http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_expressions.html
--
Nobu Nakada
=end
Updated by shyouhei (Shyouhei Urabe) over 15 years ago
=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
Updated by shyouhei (Shyouhei Urabe) over 15 years ago
- File tLABEL.patch tLABEL.patch added
=begin
=end
Updated by shyouhei (Shyouhei Urabe) over 15 years ago
=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/1183Author: Akinori MUSHA
Status: Open, Priority: Normal
Assigned to: Akinori MUSHA, Category: core, Target version: Ruby 1.8.8Attached 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
Updated by shyouhei (Shyouhei Urabe) over 15 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
Applied in changeset r24338.
=end
Updated by shyouhei (Shyouhei Urabe) over 15 years ago
=begin
Shyouhei Urabe さんは書きました:
Applied in changeset r24338.
とりあえずNEWSは書きましたが、テストはどこに突っ込めばいいんでしょうか...
Attachment: signature.asc
=end