February 10, 2022 Re: Added copy constructors to "Programming in D" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mathias LANG | On Thursday, 10 February 2022 at 08:06:23 UTC, Mathias LANG wrote:
> make `auto` peel the outermost qualifier level inside functions.
Shouldn't do that for class references. Otherwise seems fine.
|
February 10, 2022 Re: Added copy constructors to "Programming in D" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Thursday, 10 February 2022 at 20:34:29 UTC, Walter Bright wrote:
> On 2/10/2022 12:06 AM, Mathias LANG wrote:
>> I think an *immediate* improvement we could make to ease people's life is to make `auto` peel the outermost qualifier level inside functions.
>>
>> So that:
>> ```D
>> const int* ptr;
>> auto p2 = ptr;
>> static assert(is(typeof(p2) == const(int)*));
>> ```
>>
>> I really can't think of any downside to it, only upsides:
>> - It is still predictable / consistent;
>> - It *might* reduce the number of template instantiations in some cases;
>> - It just flows more naturally... If you want full constness, there's still `const`;
>
> It sounds sensible to me.
Didn't Scott Meyers cover exactly this in his "the last thing D needs" talk? It seems like a really bad idea.
|
February 11, 2022 Re: Added copy constructors to "Programming in D" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Meta | On Thursday, 10 February 2022 at 23:21:50 UTC, Meta wrote:
> On Thursday, 10 February 2022 at 20:34:29 UTC, Walter Bright wrote:
>> On 2/10/2022 12:06 AM, Mathias LANG wrote:
>>> I think an *immediate* improvement we could make to ease people's life is to make `auto` peel the outermost qualifier level inside functions.
>>>
>>> So that:
>>> ```D
>>> const int* ptr;
>>> auto p2 = ptr;
>>> static assert(is(typeof(p2) == const(int)*));
>>> ```
>>>
>>> I really can't think of any downside to it, only upsides:
>>> - It is still predictable / consistent;
>>> - It *might* reduce the number of template instantiations in some cases;
>>> - It just flows more naturally... If you want full constness, there's still `const`;
>>
>> It sounds sensible to me.
>
> Didn't Scott Meyers cover exactly this in his "the last thing D needs" talk? It seems like a really bad idea.
Well D has already taken the piss on that talk a long time ago.
No offense to D overall, and I still love it.
|
February 11, 2022 Re: Added copy constructors to "Programming in D" | ||||
---|---|---|---|---|
| ||||
Posted in reply to bauss | On Friday, 11 February 2022 at 10:06:32 UTC, bauss wrote:
>> Didn't Scott Meyers cover exactly this in his "the last thing D needs" talk? It seems like a really bad idea.
>
> Well D has already taken the piss on that talk a long time ago.
>
> No offense to D overall, and I still love it.
Rumours that Ali's next book will be called "Effective D++" are..... true ;-)
|
Copyright © 1999-2021 by the D Language Foundation