Is there any hope for "lazy" and @nogc?

Seb seb at wilzba.ch
Thu Aug 2 14:14:23 UTC 2018


On Wednesday, 1 August 2018 at 20:32:11 UTC, Iain Buclaw wrote:
> On 1 August 2018 at 18:52, Shachar Shemesh via Digitalmars-d 
> <digitalmars-d at puremagic.com> wrote:
>> [...]
>
> My first thought was to have a look at enforce(), but on closer 
> observation it is neither @nogc or nothrow.
>
> Maybe you should raise a bug report?
>
> It's certainly worth an attempt to bridge these two features 
> together. I think it makes sense enough that lazy parameters 
> should infer attributes from the function, and that it should 
> be an error to pass a parameter that does not meet those 
> constraints.
>
> i.e:
> ---
> // Signatures.
> void myAssert(bool cond, lazy string msg) @nogc nothrow;
> string mayAlloc() nothrow;
> string mayThrow() @nogc;
>
> // Code
> myAssert(cond, mayAlloc());    // violates @nogc
> myAssert(cond, mayThrow());    // violates nothrow
> ---
>
> Iain.

Isn't this https://issues.dlang.org/show_bug.cgi?id=12647?


More information about the Digitalmars-d mailing list