DIP25 draft available for destruction

Johannes Pfau nospam at example.com
Thu Feb 7 00:15:18 PST 2013


Am Wed, 06 Feb 2013 02:38:17 -0500
schrieb Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org>:

> Probably it'll need a fair amount of tweaking. Anyhow it's in 
> destroyable form.
> 
> http://wiki.dlang.org/DIP25
> 
> 
> Thanks,
> 
> Andrei

Regarding the questions about scope parameters and allowing & in system
code, wouldn't it make sense to change the rules to the following:

* Taking the address in @system code is allowed. You can do everything
  with the returned address just as right now.

* Taking the address in @safe code is also allowed, but you can't do
  anything with it: You can't assign it to anything, can't return it
  and can't dereference it.

** Once full escape analysis and scope parameters are implemented,
   those rule will be relaxed a little and passing such pointers to
   some functions (e.g. as scope parameters) will be allowed in @safe
   code.

** addressOf isn't necessary as you can take addresses in @system code
   anyway 

This makes more sense than disallowing the & operator completely
as we'd have to reintroduce it anyway once scope is implemented. This
way we start with a strict, conservative way and relax the rules when
the compiler can prove that the operations are really safe.


More information about the Digitalmars-d mailing list