[Nickle] Nickle bug/misfeature: storage for growable arrays of
growable arrays
Bart Massey
nickle at po8.org
Sat Jan 15 13:45:08 PST 2005
If you want things to be like C, you can just make
struct s;
mean
struct s = {};
and similarly for arrays.
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.
Bart
In message <E1CpvZU-0007Q2-PL at evo.keithp.com> you wrote:
> --===============1729504572==
> Content-Type: multipart/signed; boundary="==_Exmh_1309921132P";
> micalg=pgp-sha1; protocol="application/pgp-signature"
> Content-Transfer-Encoding: 7bit
>
> --==_Exmh_1309921132P
> Content-Type: text/plain; charset=utf-8
>
>
> 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
> uninitialized.
>
> > 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...
>
> -keith
>
>
>
> --==_Exmh_1309921132P
> Content-Type: application/pgp-signature
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.5 (GNU/Linux)
> Comment: Exmh version 2.3.1 11/28/2001
>
> iD8DBQFB6YyEQp8BWwlsTdMRAkk6AKDcoPB+Sol7WOLE2KMeGrJjbyxorgCggNxL
> KotIs1Pl2rmg1wfg6jq6ZSc=
> =6aaR
> -----END PGP SIGNATURE-----
>
> --==_Exmh_1309921132P--
>
>
> --===============1729504572==
> Content-Type: text/plain; charset="us-ascii"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline
>
> _______________________________________________
> Nickle mailing list
> Nickle at nickle.org
> http://nickle.org/mailman/listinfo/nickle
>
> --===============1729504572==--
>
More information about the Nickle
mailing list