There's no magic. No variable is ever rebound by a function call. Period.
On Wed, Dec 18, 2013 at 5:32 PM, David van Leeuwen < [email protected]> wrote: > Hi, > > > On Wednesday, December 18, 2013 3:00:44 AM UTC+1, Steven G. Johnson wrote: >> >> On Monday, December 16, 2013 6:08:40 PM UTC-5, David van Leeuwen wrote: >>> >>> I've been wondering if it is possible to write a pass-by-reference >>> function that alters the size of an array. >>> >> >> To answer your original question, yes it is possible. See, for example, >> the push! function in the standard library. However, as Stefan pointed >> out, this is not what your code is doing. >> > > Thanks, I mentioned that in the original post. push! relies on a Ccall > that does the magic. > > The "solution" I use right now is to embed the array in something else > (another array or a type), so that a change of binding inside appears like > the change of the object itself, but obviously there is a complete creation > of a new array and the release of the old one. Something like > > ---david >
