Multiple return values? Call-by-reference?
Yes, call-by-reference where modification of the arguments is wanted; pike uses call-by-reference extensively already but it doesn't allow that. Pointers as argument would typically work as a replacement for multiple return values. It offers the benefit of accurate typing compared to the current implementation of multiple return values, and it's also slightly more efficient since dynamic allocation of short lived arrays is avoided.
Iteration?
Not really; the iterators already covers that. It's mostly a matter of syntactic sugar for dereferencing them.
Something else?
Yes, the possibility to return pointers that can be used in lvalue contexts. This is very interesting for collections and iterators. I.e. `[]= can be replaced with `&[] in collections where the values are modifiable and it would work efficiently in cases like foo[17] += ({0}), foo[17] &= (<1,2,3>) etc. The alternative approach to allow optimization of such operations is to introduce a plethora of lfuns like `[]+=, `[]&=, `[]*=, etc.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-04-16 03:07: Subject: Pointers/lvalues
What would you primarily use pointers for?
Multiple return values? Call-by-reference? Iteration? Something else?
I personally don't like laying down in the path of progress, (especially if it's moving very fast) but I think pointers would be a step backwards for Pike. However, I will reserve final judgement until I figure out what it's good for. God knows I've implemented a few dubious things in Pike. :)
/ Fredrik (Naranek) Hubinette (Real Build Master)