| Thread overview |
|---|
June 19, 2015 Time to remove ugly auto ref ? | ||||
|---|---|---|---|---|
| ||||
Hi all !
It's too ugly that we cannot write simply « ref in » on functions argument.
Many of functions expects a const argument and don't want to know is it a temp object or not.
In C++ we can write
struct Number {
Number operator+(const Number &num);
...
};
And then use it as « auto c = a + Number(123);
But in D we cannot. Why ? Because ref doesn't accept temp objects.
We need to use auto ref. OK, but auto ref cannot be used on non-templated function.
We need even more make that function templated. It leads to a code bloat.
I don't see a reason why « auto ref » even exists.
I think we need to accept temp objects on functions arguments marked « const ref » : no auto required and functions is not a template.
That change will not break any exiting code : it only allows a const ref to accept a temporal object.
In future we can simple deprecate « auto ref » so users will adjust their code.
| ||||
June 19, 2015 Re: Time to remove ugly auto ref ? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Temtaime | I've made a PR: https://github.com/D-Programming-Language/dmd/pull/4717 | |||
June 19, 2015 Re: Time to remove ugly auto ref ? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Namespace | Hi ! I think that's great but isn't it better to use « ref in » instead ? | |||
June 19, 2015 Re: Time to remove ugly auto ref ? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Temtaime | On Friday, 19 June 2015 at 12:34:49 UTC, Temtaime wrote:
> Hi !
> I think that's great but isn't it better to use « ref in » instead ?
Search for DIP 36 and look what the decision was.
| |||
June 19, 2015 Re: Time to remove ugly auto ref ? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Namespace | On Fri, 19 Jun 2015 08:28:17 -0400, Namespace <rswhite4@gmail.com> wrote:
> I've made a PR:
> https://github.com/D-Programming-Language/dmd/pull/4717
What's the holdup on this anyways?
Bit
| |||
June 19, 2015 Re: Time to remove ugly auto ref ? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to bitwise | On Friday, 19 June 2015 at 14:49:59 UTC, bitwise wrote:
> On Fri, 19 Jun 2015 08:28:17 -0400, Namespace <rswhite4@gmail.com> wrote:
>
>> I've made a PR:
>> https://github.com/D-Programming-Language/dmd/pull/4717
>
> What's the holdup on this anyways?
>
> Bit
having a way to track important PRs would be nice.
| |||
June 19, 2015 Re: Time to remove ugly auto ref ? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to bitwise | On Friday, 19 June 2015 at 14:49:59 UTC, bitwise wrote:
> On Fri, 19 Jun 2015 08:28:17 -0400, Namespace <rswhite4@gmail.com> wrote:
>
>> I've made a PR:
>> https://github.com/D-Programming-Language/dmd/pull/4717
>
> What's the holdup on this anyways?
>
> Bit
I've pinged him already two times, but no reaction so far. Therefore I guess Andrei has a lot to do and will see about it later.
| |||
June 19, 2015 Re: Time to remove ugly auto ref ? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to rsw0x | On Fri, 19 Jun 2015 11:34:23 -0400, rsw0x <anonymous@anonymous.com> wrote:
> having a way to track important PRs would be nice.
I agree. With conversations often spanning between the NG, pull-comments, maybe private emails, it's especially hard for new-comers to figure out what's going on.
Bit
| |||
June 19, 2015 Re: Time to remove ugly auto ref ? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Namespace | On 6/19/15 9:14 AM, Namespace wrote:
> On Friday, 19 June 2015 at 14:49:59 UTC, bitwise wrote:
>> On Fri, 19 Jun 2015 08:28:17 -0400, Namespace <rswhite4@gmail.com> wrote:
>>
>>> I've made a PR:
>>> https://github.com/D-Programming-Language/dmd/pull/4717
>>
>> What's the holdup on this anyways?
>>
>> Bit
>
> I've pinged him already two times, but no reaction so far. Therefore I
> guess Andrei has a lot to do and will see about it later.
It's one of my 21 opened browser tabs... I should discuss this with Walter today. -- Andrei
| |||
June 19, 2015 Re: Time to remove ugly auto ref ? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Friday, 19 June 2015 at 16:53:26 UTC, Andrei Alexandrescu wrote:
> On 6/19/15 9:14 AM, Namespace wrote:
>> On Friday, 19 June 2015 at 14:49:59 UTC, bitwise wrote:
>>> On Fri, 19 Jun 2015 08:28:17 -0400, Namespace <rswhite4@gmail.com> wrote:
>>>
>>>> I've made a PR:
>>>> https://github.com/D-Programming-Language/dmd/pull/4717
>>>
>>> What's the holdup on this anyways?
>>>
>>> Bit
>>
>> I've pinged him already two times, but no reaction so far. Therefore I
>> guess Andrei has a lot to do and will see about it later.
>
> It's one of my 21 opened browser tabs... I should discuss this with Walter today. -- Andrei
Great to hear that! :)
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply