The behaviour is a little surprising if you don’t understand why it’s different in these cases. But no I can’t think of any non-pathological reason to actually do this in production code and I agree that the performance benefit is probab...joel@drapper.me (Joel Drapper)
If you call a method and pass in a splat of an array with a block argument coerced from calling a method, Ruby maintains the expected execution order and the called method receives a copy of the array prior to modification. In this ex...joel@drapper.me (Joel Drapper)
Your examples of `strong` and `em` return a string but they don't buffer it anywhere. In order to use them like this `strong { em { text("Hello") } }`, they would need to buffer the opening tag, yield, and then buffer the closing tag. *...joel@drapper.me (Joel Drapper)
Calling `binding` on a C-level proc (from `&:symbol`) raises an `ArgumentError`, "Can't create Binding from C level Proc" but there is no way to tell if a given proc is a C-level proc before calling `binding` on it. It’s possible to resc...joel@drapper.me (Joel Drapper)
Yes, I included an example in the original description. If we need to wrap a Proc in another Proc, there doesn't seem to be a clean way to do that. My first thought was to use this pattern: ```ruby when "text" result = -> { text n...joel@drapper.me (Joel Drapper)
I don't know if this concept exists under another name, or whether there’s a technical term for it. I often find myself wanting to wrap a proc in another proc. Here's a snippet from a recent example where a visitor class renders a Tip...joel@drapper.me (Joel Drapper)
This would be really helpful for checking if a class has redefined a method inherited form a superclass. As an example, I’m working on a compiler that replaces certain method calls with their inlined expected behaviour from an abstrac...joel@drapper.me (Joel Drapper)
I really like the first option but unfortunately it would make every object respond to `to_proc` even when they don't respond to `call`. Perhaps a third option would be for the `&` prefix operator to try to coerce using `to_proc` and the...joel@drapper.me (Joel Drapper)
I've been experimenting with doing memoization by passing a block to `attr_reader` / `attr_accessor`, e.g. ```ruby attr_reader(:foo) { something_slow } ``` or ```ruby attr_reader :foo do something_slow end ``` I prototyped this in ...joel@drapper.me (Joel Drapper)