From: kodnin@... Date: 2020-09-26T07:40:25+00:00 Subject: [ruby-core:100168] [Ruby master Bug#17193] Endless method definition doesn't work with lambdas Issue #17193 has been updated by kodnin (David Boot). wanabe (_ wanabe) wrote in #note-1: > I think this is an irb problem, not a ruby problem. > > ``` > $ ruby -ve 'def bar() = lambda { |x| x * x };p bar' > ruby 3.0.0dev (2020-09-25T22:52:04Z master 137fa5b27e) [x86_64-linux] > # > ``` I can confirm that this works indeed. ``` $ ruby -e 'def bar() = ->(x) { x * x }; puts bar.(3)' 9 ``` ---------------------------------------- Bug #17193: Endless method definition doesn't work with lambdas https://bugs.ruby-lang.org/issues/17193#change-87738 * Author: kodnin (David Boot) * Status: Open * Priority: Normal * ruby -v: ruby 3.0.0preview1 (2020-09-25 master 0096d2b895) [x86_64-darwin19] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- Endless method definition doesn't work with lambdas. Please check the attached screenshot. ``` ruby def foo() = 123 # => :foo foo # => 123 def bar() = lambda { |x| x * x } # I expected the method to be defined. def bar() = ->(x) { x * x } # Same issue. ``` Nice to have: ``` ruby def bar = lambda { |x| x * x } def bar = ->(x) { x * x } ``` ---Files-------------------------------- Screenshot 2020-09-26 at 09.19.24.png (714 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: