Forum: Ruby-core [ruby-trunk - Bug #7615][Open] assignment to context variable changes the precedence order of functi

Posted by snoble (Steven Noble) (Guest)
on 2012-12-24 07:18
(Received via mailing list)
Issue #7615 has been reported by snoble (Steven Noble).

----------------------------------------
Bug #7615: assignment to context variable changes the precedence order 
of function call with followed by ' (' (whitespace-bracket)
https://bugs.ruby-lang.org/issues/7615

Author: snoble (Steven Noble)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: ruby 2.0.0dev (2012-12-01 trunk 38126) [x86_64-darwin12.2.0]


this is similar to http://bugs.ruby-lang.org/issues/1801 but it wasn't 
pointed out then that ruby will use two different parsings at different 
times

note that in this code `a` and `b` have the same assignment code but are 
assigned different values
code:
def foo(x); 99; end
a = foo (44) / 11
foo = 99999999
b = foo (44) / 11
puts "a: #{a} b: #{b}" #output of "a: 99 b: 9"

The output of ruby_parser is:
s(:block,
 s(:defn, :foo, s(:args, :x), s(:lit, 99))
 s(:lasgn, :a, s(:call, nil, :foo, s(:call, s(:lit, 44), :/, s(:lit, 
11)))),
 s(:lasgn, :foo, s(:lit, 999999999)),
 s(:lasgn, :b, s(:call, s(:call, nil, :foo, s(:lit, 44)), :/, s(:lit, 
11)))
)

observed in 1.9.4 and 2.0.0-preview2, but does not occur in 1.8.7
Posted by snoble (Steven Noble) (Guest)
on 2013-01-21 20:47
(Received via mailing list)
Issue #7615 has been updated by snoble (Steven Noble).


is this result not extremely surprising to anyone else? I would expect 
`a` and `b` to be assigned the same value
----------------------------------------
Bug #7615: assignment to context variable changes the precedence order 
of function call with followed by ' (' (whitespace-bracket)
https://bugs.ruby-lang.org/issues/7615#change-35517

Author: snoble (Steven Noble)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: ruby 2.0.0dev (2012-12-01 trunk 38126) [x86_64-darwin12.2.0]


this is similar to http://bugs.ruby-lang.org/issues/1801 but it wasn't 
pointed out then that ruby will use two different parsings at different 
times

note that in this code `a` and `b` have the same assignment code but are 
assigned different values
code:
def foo(x); 99; end
a = foo (44) / 11
foo = 99999999
b = foo (44) / 11
puts "a: #{a} b: #{b}" #output of "a: 99 b: 9"

The output of ruby_parser is:
s(:block,
 s(:defn, :foo, s(:args, :x), s(:lit, 99))
 s(:lasgn, :a, s(:call, nil, :foo, s(:call, s(:lit, 44), :/, s(:lit, 
11)))),
 s(:lasgn, :foo, s(:lit, 999999999)),
 s(:lasgn, :b, s(:call, s(:call, nil, :foo, s(:lit, 44)), :/, s(:lit, 
11)))
)

observed in 1.9.4 and 2.0.0-preview2, but does not occur in 1.8.7
Posted by ko1 (Koichi Sasada) (Guest)
on 2013-01-25 04:55
(Received via mailing list)
Issue #7615 has been updated by ko1 (Koichi Sasada).

Category set to core
Assignee set to nobu (Nobuyoshi Nakada)
Target version set to 2.0.0

Nobu, could you check it?

----------------------------------------
Bug #7615: assignment to context variable changes the precedence order 
of function call with followed by ' (' (whitespace-bracket)
https://bugs.ruby-lang.org/issues/7615#change-35612

Author: snoble (Steven Noble)
Status: Open
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-12-01 trunk 38126) [x86_64-darwin12.2.0]


this is similar to http://bugs.ruby-lang.org/issues/1801 but it wasn't 
pointed out then that ruby will use two different parsings at different 
times

note that in this code `a` and `b` have the same assignment code but are 
assigned different values
code:
def foo(x); 99; end
a = foo (44) / 11
foo = 99999999
b = foo (44) / 11
puts "a: #{a} b: #{b}" #output of "a: 99 b: 9"

The output of ruby_parser is:
s(:block,
 s(:defn, :foo, s(:args, :x), s(:lit, 99))
 s(:lasgn, :a, s(:call, nil, :foo, s(:call, s(:lit, 44), :/, s(:lit, 
11)))),
 s(:lasgn, :foo, s(:lit, 999999999)),
 s(:lasgn, :b, s(:call, s(:call, nil, :foo, s(:lit, 44)), :/, s(:lit, 
11)))
)

observed in 1.9.4 and 2.0.0-preview2, but does not occur in 1.8.7
Posted by mame (Yusuke Endoh) (Guest)
on 2013-02-18 17:52
(Received via mailing list)
Issue #7615 has been updated by mame (Yusuke Endoh).

Subject changed from assignment to context variable changes the 
precedence order of function call with followed by ' (' 
(whitespace-bracket) to assignment to context variable changes the 
precedence order of function call with followed by ' (' 
(whitespace-bracket)
Status changed from Open to Assigned
Target version changed from 2.0.0 to next minor

Interesting, but I'm reluctant to fix this in 2.0.0 because it looks 
impractical and incompatible to 1.9.X.

--
Yusuke Endoh <mame@tsg.ne.jp>
----------------------------------------
Bug #7615: assignment to context variable changes the precedence order 
of function call with followed by &#x27; (&#x27; (whitespace-bracket)
https://bugs.ruby-lang.org/issues/7615#change-36563

Author: snoble (Steven Noble)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: core
Target version: next minor
ruby -v: ruby 2.0.0dev (2012-12-01 trunk 38126) [x86_64-darwin12.2.0]


this is similar to http://bugs.ruby-lang.org/issues/1801 but it wasn't 
pointed out then that ruby will use two different parsings at different 
times

note that in this code `a` and `b` have the same assignment code but are 
assigned different values
code:
def foo(x); 99; end
a = foo (44) / 11
foo = 99999999
b = foo (44) / 11
puts "a: #{a} b: #{b}" #output of "a: 99 b: 9"

The output of ruby_parser is:
s(:block,
 s(:defn, :foo, s(:args, :x), s(:lit, 99))
 s(:lasgn, :a, s(:call, nil, :foo, s(:call, s(:lit, 44), :/, s(:lit, 
11)))),
 s(:lasgn, :foo, s(:lit, 999999999)),
 s(:lasgn, :b, s(:call, s(:call, nil, :foo, s(:lit, 44)), :/, s(:lit, 
11)))
)

observed in 1.9.4 and 2.0.0-preview2, but does not occur in 1.8.7
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.