emplace, scope, enforce [Was: Re: Manual...]

Philippe Sigaud philippe.sigaud at gmail.com
Thu Jul 22 11:20:45 PDT 2010


On Thu, Jul 22, 2010 at 00:27, Andrei Alexandrescu <
SeeWebsiteForEmail at erdani.org> wrote:

> The double destructor hits a bug in the compiler implementation. Anyway,
> here's the committed code:
>
> http://www.dsource.org/projects/phobos/changeset/1774
>
> It uses a new idiom that is enabled by auto returns - defines a struct
> inside the function and returns it. That's a veritable existential type! (
> http://stackoverflow.com/questions/292274/what-is-an-existential-type) I
> expect more of that idiom in the upcoming commits.


Hmm, so the struct Scoped is implicitly parametrized by T and Args... Cool.

Why do you put a second layer of (Args...) in Scoped constructor? Why not
just

this(Args args) if (etc) {...}

And, in your case, if you used Args inside Scoped (which you don't do),
would that be the ctor's Args which'd be used?


Philippe

PS: too bad that, if bug 2581 is not squashed, your scoped won't show in the
docs :(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20100722/645bf208/attachment.html>


More information about the Digitalmars-d mailing list