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

Keith Packard keithp at keithp.com
Sat Jan 15 13:35:00 PST 2005

Around 11 o'clock on Jan 15, "Bart Massey" wrote:

> Sigh.  Do we want this
>    struct {int x;} s;
> to be different from this?
>    struct {int x;} s = {};

The reasoning was that in C, composite datatypes are automatically 
allocated but not automatically initialized, so we wanted things in nickle 
to work about the same -- storage automatically allocated, but values left 

> For growable arrays, it gets more complicated, since
> growable arrays of objects (of any type) don't have a
> "default value" like hashes do.  This should probably be
> fixed.  Perhaps things like
>    int[...][...] a = {{} ...};
> should work?

We've shied from this because comprehensions make it "hard".  Although 
it would be cool:

	int[...] primes = { [i] = nth_prime(i,[]) };

could lazily compute all primes with a sieve...


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
Url : /pipermail/nickle/attachments/20050115/9baea9c8/attachment.pgp

More information about the Nickle mailing list