CTFE casts of delegates

Seb via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 4 08:19:52 PST 2017


On Wednesday, 4 January 2017 at 16:06:11 UTC, Stefan Koch wrote:
> On Wednesday, 4 January 2017 at 08:45:59 UTC, Eyal Lotem wrote:
>> On Tuesday, 3 January 2017 at 09:44:38 UTC, Stefan Koch wrote:
>>
>>> I think that I can provide a dmd patch that would allow the 
>>> casts you want at ctfe.
>>> However I would not propose it for inclusion myself.
>>
>> A cast that only fiddles with function attributes like @nogc 
>> should be perfectly safe, shouldn't it?
>
> Honestly I am not sure about it.
> I guess I could enable this back-door for you and others.


This back-door already exists, see e.g.:

https://github.com/nordlow/phobos-next/blob/master/src/dbgio.d#L13

and

http://forum.dlang.org/post/nq4eol$2h34$1@digitalmars.com

> Patch will follow in the next days, I am not sure if it will be 
> merged though.

There is assumeWontThrow 
(https://dlang.org/phobos/std_exception.html#.assumeWontThrow) in 
std.exception, so I think the chances for assumeNogc or 
assumePure aren't that bad ;-)


More information about the Digitalmars-d mailing list