[Nickle] Nickle bug/misfeature: storage for growable arrays of growable arrays

nickle at po8.org nickle at po8.org
Sat Jan 15 20:42:43 PST 2005

In message <E1CpxUI-0007d0-CR at evo.keithp.com> you wrote:
> Around 13 o'clock on Jan 15, "Bart Massey" wrote:
> > If you want things to be like C, you can just make
> >    struct s;
> > mean
> >    struct s = {};
> > and similarly for arrays.
> Right, that's what we have today.

It didn't sound like it for your earlier description.  It
sounded like you had some lazy initialization thing going
on.  Did I misunderstand?

> > Shy of growable array initializers via continuations :-), I
> > would just like initializer expressions to work like they do
> > for hashes.  This would at least take care of the nested
> > growable array case, which is the thing I normally care
> > about anyhow.  And after all, we don't have hash
> > comprehensions.
> Hashes have a 'default value' which is used to initialize any 
> uninitialized element when referenced.  We could do the same for growable 
> arrays if that would be sufficient, and I can compute that when the array 
> is computed.

That's what I was hoping for.

> The trouble I'm having now is how to compute a nested array 
> value when the array is used in some completely different context.  I 
> don't, in general, have a pointer back to the frame holding the dimension 
> information for the nested array.

Just do the same thing with arrays you do with structs: let
  int[...][...] a;
be shorthand for
  int[...][...] a = {{} ...};
and the default value should take care of it, I think?


More information about the Nickle mailing list