Jump to page: 1 2
Thread overview
"alias that this" or "alias this : that"
Feb 07, 2014
Mike
Feb 07, 2014
Meta
Feb 07, 2014
Tofu Ninja
Feb 07, 2014
Daniel Kozak
Feb 07, 2014
Timon Gehr
Feb 07, 2014
deadalnix
Feb 07, 2014
Jakob Ovrum
Feb 07, 2014
Timon Gehr
Feb 07, 2014
Mike
Feb 08, 2014
Timon Gehr
Feb 08, 2014
Jakob Ovrum
Feb 08, 2014
Timon Gehr
Feb 08, 2014
Jakob Ovrum
Feb 13, 2014
Nick Treleaven
Feb 07, 2014
Mike
Feb 07, 2014
Jesse Phillips
Feb 08, 2014
Mike
February 07, 2014
Can someone please clarify for me which of these is the "preferred" syntax?

alias that this;
alias this : that;

The documentation here (http://dlang.org/class.html#AliasThis) doesn't mention the latter.  I'll do the unrewarding work of updating the docs if someone could just please tell me which syntax the core language folks prefer.

Thanks.
Mike

For context:
https://github.com/D-Programming-Language/dmd/pull/1413
https://github.com/D-Programming-Language/dmd/pull/1685
February 07, 2014
On Friday, 7 February 2014 at 07:36:57 UTC, Mike wrote:
> Can someone please clarify for me which of these is the "preferred" syntax?
>
> alias that this;
> alias this : that;
>
> The documentation here (http://dlang.org/class.html#AliasThis) doesn't mention the latter.  I'll do the unrewarding work of updating the docs if someone could just please tell me which syntax the core language folks prefer.
>
> Thanks.
> Mike
>
> For context:
> https://github.com/D-Programming-Language/dmd/pull/1413
> https://github.com/D-Programming-Language/dmd/pull/1685

`alias this : that` was discussed but has never been implemented, so currently the only way to do it is `alias that this`.
February 07, 2014
On Friday, 7 February 2014 at 07:52:22 UTC, Meta wrote:
> On Friday, 7 February 2014 at 07:36:57 UTC, Mike wrote:
>> Can someone please clarify for me which of these is the "preferred" syntax?
>>
>> alias that this;
>> alias this : that;
>>
>> The documentation here (http://dlang.org/class.html#AliasThis) doesn't mention the latter.  I'll do the unrewarding work of updating the docs if someone could just please tell me which syntax the core language folks prefer.
>>
>> Thanks.
>> Mike
>>
>> For context:
>> https://github.com/D-Programming-Language/dmd/pull/1413
>> https://github.com/D-Programming-Language/dmd/pull/1685
>
> `alias this : that` was discussed but has never been implemented, so currently the only way to do it is `alias that this`.

Is alias this = that not a thing? If not, why?
February 07, 2014
On Friday, 7 February 2014 at 20:48:37 UTC, Tofu Ninja wrote:
> On Friday, 7 February 2014 at 07:52:22 UTC, Meta wrote:
>> On Friday, 7 February 2014 at 07:36:57 UTC, Mike wrote:
>>> Can someone please clarify for me which of these is the "preferred" syntax?
>>>
>>> alias that this;
>>> alias this : that;
>>>
>>> The documentation here (http://dlang.org/class.html#AliasThis) doesn't mention the latter.  I'll do the unrewarding work of updating the docs if someone could just please tell me which syntax the core language folks prefer.
>>>
>>> Thanks.
>>> Mike
>>>
>>> For context:
>>> https://github.com/D-Programming-Language/dmd/pull/1413
>>> https://github.com/D-Programming-Language/dmd/pull/1685
>>
>> `alias this : that` was discussed but has never been implemented, so currently the only way to do it is `alias that this`.
>
> Is alias this = that not a thing? If not, why?
Because
alias this = that;
alias this = anotherThat;

is wierd
February 07, 2014
On 02/07/2014 10:02 PM, Daniel Kozak wrote:
> On Friday, 7 February 2014 at 20:48:37 UTC, Tofu Ninja wrote:
>> On Friday, 7 February 2014 at 07:52:22 UTC, Meta wrote:
>>> ...
>>
>> Is alias this = that not a thing? If not, why?
> Because
> alias this = that;
> alias this = anotherThat;
>
> is wierd

Even if we assume for now that this is somehow bad, it is no reason to have syntax inconsistent with alias.

int baz(int x){ return x; }
double bar(double x){ return x; }

alias foo = bar;
alias foo = baz;

February 07, 2014
On Friday, 7 February 2014 at 21:30:46 UTC, Timon Gehr wrote:
> On 02/07/2014 10:02 PM, Daniel Kozak wrote:
>> On Friday, 7 February 2014 at 20:48:37 UTC, Tofu Ninja wrote:
>>> On Friday, 7 February 2014 at 07:52:22 UTC, Meta wrote:
>>>> ...
>>>
>>> Is alias this = that not a thing? If not, why?
>> Because
>> alias this = that;
>> alias this = anotherThat;
>>
>> is wierd
>
> Even if we assume for now that this is somehow bad, it is no reason to have syntax inconsistent with alias.
>
> int baz(int x){ return x; }
> double bar(double x){ return x; }
>
> alias foo = bar;
> alias foo = baz;

+1
February 07, 2014
On Friday, 7 February 2014 at 07:36:57 UTC, Mike wrote:
> Can someone please clarify for me which of these is the "preferred" syntax?
>
> alias that this;
> alias this : that;
>
> The documentation here (http://dlang.org/class.html#AliasThis) doesn't mention the latter.  I'll do the unrewarding work of updating the docs if someone could just please tell me which syntax the core language folks prefer.
>
> Thanks.
> Mike
>
> For context:
> https://github.com/D-Programming-Language/dmd/pull/1413
> https://github.com/D-Programming-Language/dmd/pull/1685

I'd like for 'alias that this' to go away.

I'm fine with 'alias this = that'

If we must 'alias this : that' or "this implicitly casts to that" is also reasonable to me.

Yes 'alias that this' can stay for backwards compatibility.

No 'alias this : that' has not been implemented (that I'm aware of).
February 07, 2014
On Friday, 7 February 2014 at 21:30:46 UTC, Timon Gehr wrote:
> On 02/07/2014 10:02 PM, Daniel Kozak wrote:
>> On Friday, 7 February 2014 at 20:48:37 UTC, Tofu Ninja wrote:
>>> On Friday, 7 February 2014 at 07:52:22 UTC, Meta wrote:
>>>> ...
>>>
>>> Is alias this = that not a thing? If not, why?
>> Because
>> alias this = that;
>> alias this = anotherThat;
>>
>> is wierd
>
> Even if we assume for now that this is somehow bad, it is no reason to have syntax inconsistent with alias.
>
> int baz(int x){ return x; }
> double bar(double x){ return x; }
>
> alias foo = bar;
> alias foo = baz;

Reserving `alias this = ...;` allows adding aliasing of constructors in the future, assuming it can be meaningfully defined.
February 07, 2014
On 02/07/2014 11:23 PM, Jakob Ovrum wrote:
>>
>
> Reserving `alias this = ...;` allows adding aliasing of constructors in
> the future, assuming it can be meaningfully defined.

What a mess that would be. If the consensus is that alias this syntax was a mistake then _both_ forms should be removed and the concept should be re-introduced as specially named member instead.
February 07, 2014
On Friday, 7 February 2014 at 22:55:05 UTC, Timon Gehr wrote:
> On 02/07/2014 11:23 PM, Jakob Ovrum wrote:
>>>
>>
>> Reserving `alias this = ...;` allows adding aliasing of constructors in
>> the future, assuming it can be meaningfully defined.
>
> What a mess that would be. If the consensus is that alias this syntax was a mistake then _both_ forms should be removed and the concept should be re-introduced as specially named member instead.

Timon, this makes a lot of sense.  Would you mind elaborating with a simple syntax sample?
« First   ‹ Prev
1 2