[Issue 2642] .init contains zeroes

2009-02-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2642





--- Comment #7 from jarrett.billings...@gmail.com  2009-02-21 10:56 ---
(In reply to comment #6)
 One of the solutions is to introduce non-nullable types (both reference and
 value-types). In this case T.init would be useless (and thus may be safely
 removed from language*), because user will *have to* initialize it:

So, as much as I like nonnull types, and as much as I like your proposal,
there's this .. kind of icky part too.

auto a = new ClassType[10];

How exactly do you allocate an array of nonnull types?  

 * I don't mind if T.init will be removed from language specs altogether as I
 never found it useful. It may still be left for some time in compiler 
 internals
 (to copy T[] prior to calling T.__ctor), just don't expose it to users.

I've found it useful!


-- 



[Issue 2642] .init contains zeroes

2009-02-03 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2642


ma...@pochta.ru changed:

   What|Removed |Added

   Severity|normal  |enhancement




--- Comment #2 from ma...@pochta.ru  2009-02-03 02:05 ---
Other possible optimizations:
1. Move zero memory to bss section and zero it at startup. Not only .inits
contain zeroes, all static data does.
2. If zero data is invariant, different instances of this data can refer to the
same memory location, though, if programmer casts one of these pointers to
mutable data and overwrite it, this will cause disaster :)


--