[phobos] [D-Programming-Language/phobos] 601c75: Improve parsing error handling

kenji hara k.hara.pg at gmail.com
Mon Sep 5 03:31:45 PDT 2011


2011/9/5 Jonathan M Davis <jmdavisProg at gmx.com>:
> On Monday, September 05, 2011 11:20:57 Don Clugston wrote:
>> I've never been able to get that to work. Although you can get those
>> two to work, it fails in other cases. Eg, as in the code below.
>> Have you been able to do this successfully?
>>
>> [snip]
>
> Probably not. I don't think that I've tried though. I'm not sure how often
> I've used immutable structs in a context that ended up using an equality
> check.
>
> Regardless, opEquals obviously needs to be sorted out. You shouldn't need two
> definitions like that to get it to work even if they did work in all cases.

I think we need to define tow opEquals, const bool opEquals(const S
rhs) and const bool opEquals(const ref S rhs).
But rvalue version is automatically builded by compiler, like follows:

const bool opEquals(const S rhs) {
  return this.opEquals(rhs);  // run lvalue version
}

So we don't need to *write* two opEquals still.

Kenji Hara


More information about the phobos mailing list