Mill Computing, Inc. › Forums › The Mill › Architecture › Metadata › Reply To: Metadata
Returning a vector would certainly work, and the Nones are very Mill-ish. But smaller members have only 8-byte vectors. It would also cost some code to pack the vector and unpack it again, which might be worse than going via memory. The optimal might be to return one scalar and the vector; in the common case the vector would be all Nones, available as a popCon from rd() cheaply and ignored by the caller. In the uncommon case you’d pay for the pack/unpack. If exactly two results were common then return two scalars for that case and the caller can test whether it has a scalar or a vector second result.
However, because the code depends on the size of a vector then your Lisp becomes member-dependent, which we really want to avoid. 🙁