[#106355] [Ruby master Bug#18373] RBS build failure: '/include/x86_64-linux/ruby/config.h', needed by 'constants.o'. — "vo.x (Vit Ondruch)" <noreply@...>
Issue #18373 has been reported by vo.x (Vit Ondruch).
28 messages
2021/12/01
[ruby-core:106410] [Ruby master Feature#17721] Proc.new should be able to contruct a lambda
From:
"bughit (bug hit)" <noreply@...>
Date:
2021-12-02 19:35:42 UTC
List:
ruby-core #106410
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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>