http://wiki.dlang.org/DIP25

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Tue Dec 30 11:05:36 PST 2014


On Tue, 30 Dec 2014 07:14:24 -0500
Steven Schveighoffer via Digitalmars-d <digitalmars-d at puremagic.com>
wrote:

> But I agree. The problem is, most times, you WANT to ensure your code is 
> @safe pure nothrow (and now @nogc), even for template functions. That's 
> a lot of baggage to put on each signature. I just helped someone 
> recently who wanted to put @nogc on all the std.datetime code, and every 
> signature had these 4 attributes except a few. I tried to have him put a 
> big @safe: pure: nothrow: @nogc: at the top, but the occasional 
> exceptions made this impossible.
> 
> It's unfortunate we couldn't start with these being the defaults, and 
> then add the occasional @system, @unpure, and @throws where appropriate.
> 
> Some mechanism of aliasing attribute combinations is itching to get done :)

or at least the way to "undo" some attributes. we can "undo" "@safe",
but what about "notrhow"? "@nogc"? "const"? and, by the way, "final"
and "static"!

it's very handy to write something like this:
final:
nothrow:
@nogc:
  void foo () { ... }
  ...
  // and ocasionally we need this:
  virtual bar () throw @gc { ... }
  // and go on with 'final nothrow @nogc'
  ...

sure, we can move `bar` to another place, or make ugly nestes "{}"
blocks, or invent some other workarounds. but they are still
workarounds, and this frustrates me alot. if we have a way to make
something default (`final:`), we MUST have a way to cancel that
defaults both temporary and permanently.

another nice D feature that is half-done.
-------------- 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/20141230/120a496f/attachment.sig>


More information about the Digitalmars-d mailing list