Best error msg ever
Chris Wright via Digitalmars-d
digitalmars-d at puremagic.com
Fri Feb 10 21:42:31 PST 2017
On Fri, 10 Feb 2017 21:19:37 -0800, Walter Bright wrote:
> On 2/10/2017 5:14 PM, Chris Wright wrote:
>> And @safe doesn't stop you from using uninitialized variables.
>
> As shown, it does.
Default-initialized variables, sorry.
I don't see what's less safe about
cast(MyInterface)new Object
than
cast(MyInterface)null
The only difference is that there is a runtime call in between in the
first example. And we'll get a similar runtime call with similar
guarentees if it's instead
cast(MyClass)new Object
Except this version is accepted in @safe code.
It seems inconsistent, and I'm wondering what the reasoning behind it is.
The error message doesn't offer a way to reach an explanation.
More information about the Digitalmars-d
mailing list