Right, that's true.
On Thu, Dec 19, 2013 at 6:16 AM, David van Leeuwen < [email protected]> wrote: > Sorry, > > I meant the magic of resizing the array. Sorry, I did not want to suggest > variables get rebound. > > But I now see there's even a resize!() for 1d arrays, but I don't see how > I could use that for d>1. > > ---david > > > On Wednesday, December 18, 2013 11:43:10 PM UTC+1, Stefan Karpinski wrote: > >> 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 >>> >> >>
