Spec#, nullables and more

"Jérôme M. Berger" jeberger at free.fr
Sat Nov 6 00:58:07 PDT 2010


Walter Bright wrote:
> Consider non-nullable type T:
> 
>   T[] a = new T[4];
>   ... time goes by ...
>   T[1] = foo;
>   T[3] = bar;
>   ... more time goes by ...
>   bar(T[2]);
> 
> In other words, I create an array that I mean to fill in later, because
> I don't have meaningful data for it in advance. What do I use to default
> initialize it with non-nullable data? And once I do that, should
> bar(T[2]) be an error? How would I detect the error?
> 
<sarcasm>
Consider immutable type immutable T:

  immutable T] a = new immutable T[4];
  ... time goes by ...
  T[1] = foo;
  T[3] = bar;

In other words I create an array that I mean to fill in later,
because I don't have meaningful data for it in advance. How do I do
that with immutable types?
</sarcasm>

		Jerome
-- 
mailto:jeberger at free.fr
http://jeberger.free.fr
Jabber: jeberger at jabber.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20101106/ad92d8d7/attachment.pgp>


More information about the Digitalmars-d mailing list