On Fri, 11 Apr 2014 11:43:15 -0400, Dicebot <[email protected]> wrote:
On Friday, 11 April 2014 at 15:15:21 UTC, Meta wrote:
Hasn't there been a proposal before to allow @system/@trusted/@safe
blocks, allowing it to be a bit more granular than at the function
level? Maybe:
@trusted
{
arr.ptr[index]
}
Could be lowered to (() @trusted => arr.ptr[index]).
I think it was rejected for the very reason that it gives nothing over
writing this:
() @trusted
{
arr.ptr[index];
}();
It has resulted in some changes by Kenji though that guarantee that
immediately-called delegate is always inlined. Hope those were merged.
If this works as seamlessly as a statement, that is a reasonable solution.
Re: ugliness, it's not important. These are not common situations.
-Steve