Closed solson closed 12 years ago
Addition: since #2 is going to be implemented, we also need to consider what block arg passing looks like in combination with that syntax. But again, it doesn't have to be very pretty.
(. [1 2 3] map | #(+ % 1)) ;=> [2 3 4]
I think it doesn't look too bad.
This is now implemented exactly as described here.
We need to be able to pass blocks to Ruby methods that expect them from Apricot code. Block arguments are treated specially by Ruby and the following will not pass the fn as a block arg, but as a regular arg, which will fail:
One solution would be to use a special character that the send expression (the
.
) would take to mean that the next argument should be passed as the block argument. For example, using the|
character:For the most part, block argument passing should be hidden away under apricot wrappers. It should only be necessary for Ruby interop, so it need not be very pretty.