--
You received this message because you are subscribed to the Google Groups "gosu-lang" group.
To post to this group, send email to gosu...@googlegroups.com.
To unsubscribe from this group, send email to gosu-lang+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gosu-lang?hl=en.
-Alan
The implementation in bytecode is a wee bit complicated, due to the
number of different possibilities and some differences with regards to
short-circuiting depending on if the right-hand side is a primitive
value or not. We also take a different path depending on if we can
allocate the result array up front, which we can do if the left-hand
size is an array or Collection and the right-hand side is a scalar (in
which case we can cheaply know up front how big the result array
should be) or if we have to compile the results into a temporary List
which then gets turned into an array, which we do if the left-hand
side is some other Iterable or if the right-hand side is an array or
Collection, such that we don't know up-front how large to make the
result array. So there are a dozen or so different paths the compiler
can ultimately take depending on all those factors. But the end
result is effectively like calling .map() or .flatMap() or .each(),
depending on the right-hand-side of the expression.
Personally, though, I'm not a huge fan of the operator, and prefer the
explicitness of .map() and .flatMap() instead. The *. operator
predates the inclusion of blocks in Gosu, and I'm not sure we'd
necessarily add it in these days if we didn't already have it, since
we already have blocks for doing those sorts of mappings.
-Alan
-Alan