Phobos is now compiled with -preview=dip1000

H. S. Teoh hsteoh at quickfur.ath.cx
Thu May 16 00:53:17 UTC 2019


On Wed, May 15, 2019 at 11:34:44AM -0700, Walter Bright via Digitalmars-d-announce wrote:
> On 5/15/2019 11:09 AM, H. S. Teoh wrote:
> > *Why* putting 'private' on a field member makes toHash unsafe, is
> > beyond my ability to comprehend.
> 
> That's because the reduced version isn't a reduced version. It imports
> a vast amount of other code.

Alright, here's a TRULY reduced version:

----
struct S {
	private int _x;
}
struct RedBlackTree
{
    size_t toHash() nothrow @safe
    {
	return .hashOf(S.init);
    }
}
void main() { }
----

Compiling with -preview=dip1000 causes a compile error complaining that
toHash() is not @safe.  Removing 'private' makes it go away. Compiling
without -preview=dip1000 also makes it go away.

Now explain this one. :-D


T

-- 
A linguistics professor was lecturing to his class one day. "In
English," he said, "A double negative forms a positive. In some
languages, though, such as Russian, a double negative is still a
negative. However, there is no language wherein a double positive can
form a negative." A voice from the back of the room piped up, "Yeah,
yeah."


More information about the Digitalmars-d-announce mailing list