DIP 1028---Make @safe the Default---Community Review Round 1

Manu turkeyman at gmail.com
Thu Jan 9 05:57:14 UTC 2020


On Thu, Jan 9, 2020 at 3:30 PM Walter Bright via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On 1/8/2020 4:12 PM, Manu wrote:
> > unsafe blocks is distinctly preferable to me. Functions are usually >1
> > line, and I hate that we can only mark this at the function level.
> > Unsafely statements are never at the function level, it's usually just
> > one line among a larger function. An unsafe scope would be immensely
> > preferable to me, because I can make it as narrow as the code i'm
> > suspicious of, and the surrounding code doesn't lose its safe checking
> > just by being a bystander.
>
> This is routinely done in Phobos by making a tiny one line anonymous @trusted
> lambda and immediately calling it. The compiler will inline it.

Unacceptable and embarrassing.
The compiler does not inline it (appears to be subject to
optimisation), and LDC/GDC implement different inlining rules where
the compilers internal heuristics are undesirably perturbed by this
'pattern'.


More information about the Digitalmars-d mailing list