[ruby-core:90591] [Ruby trunk Misc#15428] Proc composition: what can quack like Proc?

From: zverok.offline@...
Date: 2018-12-17 21:56:38 UTC
List: ruby-core #90591
Issue #15428 has been reported by zverok (Victor Shepelev).

----------------------------------------
Misc #15428: Proc composition: what can quack like Proc?
https://bugs.ruby-lang.org/issues/15428

* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
I believe, that solution of #6284 introduced important language inconsistency: as far as I can tell, it insists that **anything that responds to `#call`** is composable, e.g. **quacks like `Proc`**.

The problem is, previously it was **never** this way. `#call` method has a nice shortcut of `.()`, but when you wanted to tell something can quack like proc, it **always** was done by defining `#to_proc` method.

I understand it could be too late to ask, but I wonder why this inconsistency was introduced and is there a plan to take this step further? 
For me personally, this `#call`/`#to_proc` dichotomy was always weird and feels like it needs some unification (maybe anything having `#call` will automatically have `#to_proc` method?), but the situation when exactly one language feature treats it differently looks pretty weird for me.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next