From: "bughit (bug hit)" Date: 2021-12-02T19:35:42+00:00 Subject: [ruby-core:106410] [Ruby master Feature#17721] Proc.new should be able to contruct a lambda Issue #17721 has been updated by bughit (bug hit). Why a new ticket? What's wrong with this one? If you wanted clarification you didn't have to close it, and even now you can still reopen. As to the substance, if you want to transform an existing proc or lambda in a way that involves creating a new one and calling the original from it, it makes sense to end up with the same "type" you started with (proc or lambda). The simplest example is negation: ```rb class Proc def negate self.class.new do |*args, &block| not self.(*args, &block) end end end ``` The above will turn a lambda into a proc. Why shouldn't the Proc constructor be able to create a lambda? Lambdas should have probably been a sub-type, but as long as they share the same type and hence constructor, it seems almost an obligation for it to be able to construct either: `Proc.new(lambda: true)` ---------------------------------------- Feature #17721: Proc.new should be able to contruct a lambda https://bugs.ruby-lang.org/issues/17721#change-95050 * Author: bughit (bug hit) * Status: Rejected * Priority: Normal ---------------------------------------- since procs and lambdas are of the same type, as long as Proc::new exists, it should be able to create either. ```ruby class Proc def augment self.class.new lambda? do call end end end ``` -- https://bugs.ruby-lang.org/ Unsubscribe: