DIP69 - Implement scope for escape proof references

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 4 17:16:36 PST 2014


On Thu, 04 Dec 2014 12:55:34 +0000
bearophile via Digitalmars-d <digitalmars-d at puremagic.com> wrote:

> This seems acceptable only if the compiler switch "-scope" 
> implies functions to be @safe by default and @system on request, 
> because currently lot of D programmers don't apply annotations 
> like @safe to their D code. Opt-in safety doesn't work well (and 
> in D we still have the problems caused by null pointers and 
> references).
actually, for me explicit attributes doesn't work well at all. and D
compiler can't infer atributes for functions (ok, it can, but it can't
apply that without changing function signature). that's why alot of my
code compiles awfully slow with separate compilation: i'm used to write
argument-less templates everywhere, so compiler can infer and apply
attributes by itself. i even stopped commenting that practice, 'cause
it means that much of the code will carry comments like this:

  // template to allow attribute inference
  void foo() (A a, int c) { ... }


i think that something is very wrong with the function attributes. but
i still can't think out how to improve that. but it still feels wrong.

that's not about "D designers made a mistake", that's about "i want to
invent a better thing!" ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20141205/fc3b551b/attachment-0001.sig>


More information about the Digitalmars-d mailing list