The main problem is that implicit conversion can be confusing, especially, if it's not obvious what the resulting proc is going to do. However, I think that hashes are being used *mainly* for making key-value pairs and accessing them ...Nondv (Dmitry Non)
This *is* a syntactic sugar. Using `&` + `to_proc` in this case is the same (not technically, but algorithmically, I guess) as providing an explicit block `something.some_method { |x| some_set.include?(x) }` I don't find it crucial in...Nondv (Dmitry Non)
Well, to be fair, this change is just nice-to-have sugar. I don't expect it to become a thing. I guess for now the best way to do that is: ```ruby pets.count { |x| dogs.include?(x) } # or pets.count(&dogs.method(:include?)) ```...Nondv (Dmitry Non)
Well, `to_proc` allows to send objects as blocks which can be quite useful not just in case of `select`/`reject`. Also, probably, those two are used more often than `grep`/`grep_v`. Another example from the top of my head is `count`: ...Nondv (Dmitry Non)
Hanmac (Hans Mackowiak) wrote: > Duplicate of #4910 > ... Hi! It's not really a duplicate since there is a different suggestion. I have written PR in C based on `Hash#to_proc` definition Nondv (Dmitry Non)
Hello! I was creating a list of class instances via `some_list.map { |e| SomeClass.new(e) }` and wondered if there's a `Class#to_proc` to make possible doing `some_list.map(&SomeClass)`. Well, there is not. Basically, this is what...Nondv (Dmitry Non)