Special Type Challenge

Meta via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 7 12:53:45 PST 2015


On Saturday, 7 February 2015 at 19:38:10 UTC, Marc Schütz wrote:
> On Saturday, 7 February 2015 at 05:27:39 UTC, Andrei 
> Alexandrescu wrote:
>> On 2/6/15 8:28 PM, Jonathan Marler wrote:
>>> Do you know if D might support that later or if there's a 
>>> reason for not
>>> supporting it?
>>
>> It's deliberate following the C++ experience. -- Andrei
>
> Hasn't there been a debate about a hypothetical 
> `opImplicitCast()`? The default would still be off, but you can 
> opt-in by defining said method.

`alias this` is pretty much `opImplicitCast`, but it currently 
has a few holes, such as 
http://forum.dlang.org/post/xcnwuneclebuyqcjbkwu@forum.dlang.org. 
It's not always appropriate in every situation though, as you get 
full-on subtyping along with implicit conversion.


More information about the Digitalmars-d mailing list