What if we have a method `Kernel#Date` that delegates to `Date.parse`? Dates could be written in a more natural way, right? ```ruby Date("2020-01-13") - Date("2019-01-13") ``` Capitalized methods are defined on the `Kernel` modul...americodls (Americo Duarte)
My two cents: This method acts like a **pipe operator**, it passes itself **through** the block and returns whatever the block returns. The block execution maybe will change the value itself, maybe not. But `yield_self` proposes **ch...americodls (Americo Duarte)
matz (Yukihiro Matsumoto) wrote: > I am for adding syntax sugar for method reference. But I don't like proposed syntax (e.g. `->`). > ... What do you think about: `Kernel:puts`, `Kernel~>puts`, `Kernel:>puts` ?americodls (Americo Duarte)
This is exactly what I am saying. This behavior of `reduce` is unpredictable and different of the another `Enumerable` methods. Users will expect that symbol argument is converted in proc and then applied to object. `reduce` (si...americodls (Americo Duarte)
Please, reconsider. Look this example: ~~~ irb(main):092:0> :puts.to_proc.call("") NoMethodError: private method `puts' called for "":String ~~~ nobu (Nobuyoshi Nakada) wrote: > The proc returned by `Symbol#to_proc` is equiva...americodls (Americo Duarte)
When use reduce with symbol, I expect the symbol is called in object but respecting the method visibility. Example with source code written in a file. ~~~ruby Fixnum.instance_eval do private :+ end p [1,2,3].reduce(:+) ~~~...americodls (Americo Duarte)
The **`->`** was just a suggestion... Could be another symbol or combination of symbols like **`Math->>sqrt`**, **`Math=>>sqrt`**, **`Math+>sqrt`**, **`Math$>sqrt`**, **`Math:>sqrt`**, etc I just think could have another way to write it...americodls (Americo Duarte)