User-defined "opIs"
Adam D. Ruppe via Digitalmars-d
digitalmars-d at puremagic.com
Wed Sep 24 16:08:25 PDT 2014
On Wednesday, 24 September 2014 at 22:48:36 UTC, Meta wrote:
> Is this supposed to work, and if not, should an enhancement be
> made to allow it?
It is not supposed to work - the docs don't list is as
overridable (http://dlang.org/expression.html look for "Identity
expressions") - and I don't think it should work either. Consider:
class A { opIs() }
if(a is null)
If that were rewritten into if(a.opIs(null))... and a were null,
you'd have some trouble. Putting in an automatic null pre-check
would start to complicate that is currently a simple operator.
More information about the Digitalmars-d
mailing list