>>>>> "DS" == Dan Sugalski <[EMAIL PROTECTED]> writes:
DS> At 06:51 AM 8/4/00 -0700, Benjamin Stuhl wrote:
>> This actually leads to a much more general question, namely
>> passing of arrays to functions. For ppcode at least and
>> probably any code using the perl API, it should be possible
>> and IMHO desirable to push the AV* (or equivalent), rather
>> than expanding the array and pushing each of its elements.
>> Furthermore, if we do this, it would make passing named
>> array arguments (sub foo (@baz, @qux) { ... }) much
>> simpler.
DS> There are some threading issues, but if we do iterators then we can
DS> definitely use this shortcut--shifting off of @_ just iterates through each
DS> array short-cut pushed onto the arg stack.
This would do away with the list/array duality. And an array return
@foo = &my_sub;
would be a couple of pointer swaps. Probably not a win, but a series
of array returns may not need to have copies made. Just leave the
array on the stack.
join ' ', grep(...), grep(....), ...
and only join would need to iterate.
I think only @_ and the named prototypes would need to be aware of the
difference.
Though what about %hash on the stack? Hmm, not a problem @_ would
use the each iterator.
<chaim>
--
Chaim Frenkel Nonlinear Knowledge, Inc.
[EMAIL PROTECTED] +1-718-236-0183