Project

General

Profile

Feature #14666

Updated by nobu (Nobuyoshi Nakada) about 6 years ago

Hi everyone at ruby/trunk 

 I encountered `nil.any?` 

 ``` nil.any? 
 undefined method `any?' for nil:NilClass (NoMethodError) 
 ``` 

 I fully agree with all of yours, 
 that `nil` nil should be kept slim. 

 But than, on the other hand, 
 the existence quantors are well defined on `nil`. nil. 

 So `nil.any?` nil.any? should always return `false` false 

 I know this might make more sense to return `NoMethodError` NoMethodError 

 But in the end `nil` nil is an object, 
 it's not a null pointer exception any more 

 We can actually talk with `nil`. nil. 

 Back in the objc days talking to `nil` nil would always return `nil`, nil, 
 Im not sure what happens if `nil` nil answers `false` false to `any?` any? 
 (currently it throws an exception, code should not depend on that) 

 I believe `nil` nil is a deep concept, 
 and ruby got far ahead with the Nil class 

 I'd like to suggest that `nil.any?{}` nil.any?{} should return false 











Back