Macro generating a do ... end block?

Ah, thanks.

The first one could do in my case.

Meanwhile I found this one also works, though it comes with the complication of having to specify the argument type explicitly – and something “generic” like Object or Number or Int won’t cut it:

macro do_mac2
  ->(n : Int32){ puts "works, #{n}" }
end

2.times &do_mac2

Assuming instead I pass the call (2.times in this case) as macro argument, is there a way to know what type(s) the call would yield?

It’s easy when it’s a yield self, but in other cases it would be useful information to be exposed, together with raised exceptions.

For context, I’m playing around inspired by RFC: with … yield replacement.


totally off topic: I often do too many things at once and leave replies hanging for even days before I decide to click “reply”. I hope they don’t show up as “replying…” all the while, sorry for that in case and let me know.