Multiple alias this is coming.
IgorStepanov via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Fri Sep 19 09:03:20 PDT 2014
On Friday, 19 September 2014 at 14:23:55 UTC, Marc Schütz wrote:
> On Friday, 19 September 2014 at 13:24:53 UTC, IgorStepanov
> wrote:
>> On Friday, 19 September 2014 at 11:25:03 UTC, Nordlöw wrote:
>>> On Thursday, 18 September 2014 at 22:13:14 UTC, IgorStepanov
>>> wrote:
>>>> Is Nullable!(T) with polymorphic type disallowed now?
>>>
>>> Sorry, I meant
>>>
>>> NotNull(T)
>>>
>>> Here's a module
>>>
>>> https://github.com/nordlow/justd/blob/master/notnull.d
>>>
>>> a bit tweak from the original design by Adam D Ruppe.
>>
>> What does a troubles with your NotNull implementation you have
>> with old alias this?
>> Do you want to implicit cast from NotNull!(T) to all other
>> NotNull!(B) where B is basetype of T?
>
> That makes me think of a question:
>
> Will the compiler instantiate a template member function, if it
> is specified as alias this?
>
> struct MyStruct {
> T convertTo(T)()
> if(...)
> {
> // implementation
> }
>
> alias convertTo this;
> }
>
> MyStruct s;
> int a = s;
> float b = s;
> string c = s;
>
> Will this work?
No, this isn't work.
You can start discussion about this feature and if it be
approved, it can be implemented in future.
More information about the Digitalmars-d-announce
mailing list