NotNull pointers
Simen Kjaeraas
simen.kjaras at gmail.com
Tue Aug 30 13:06:19 PDT 2011
On Mon, 29 Aug 2011 22:41:19 +0200, Simen Kjaeraas
<simen.kjaras at gmail.com> wrote:
> On Mon, 29 Aug 2011 22:22:52 +0200, Walter Bright
> <newshound2 at digitalmars.com> wrote:
>
>> For the latest dmd,
>> https://github.com/D-Programming-Language/dmd/commit/1193f7828b444056c943742daae0a5ccf262272e
>> ,
>> I've implemented the ability to disable default initialization. This
>> makes it practical to implement a library based "NotNull" type without
>> a special syntax for it. The rationale for this is (rather than making
>> it builtin) one can now build any type that is a restricted subset of
>> another type. I suspect that a non-null type is just scratching the
>> surface of this ability.
>
> Awesome!
>
> How does it deal with arrays whose elements have no default constructor?
>
> I believe increasing the length of such an array should be an error
> (which likely also excludes decreasing it except for slices).
Testing concludes that changing the length of the array indeed appends
structs to it, with no compile-time error. Should I file this in BugZilla?
--
Simen
More information about the Digitalmars-d
mailing list