May 30, 2017 Re: Should out/ref parameters require the caller to specify out/ref like in C#? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Petar Kirov [ZombineDev] | On Tuesday, 30 May 2017 at 09:55:14 UTC, Petar Kirov [ZombineDev] wrote: >> Unfortunately, `in` was never implemented as `scope const`. I think it was only when Walter started working actively on scope that he found out that it's too late to change this - >> https://github.com/dlang/dmd/pull/5898. Here are some more references: >> https://github.com/dlang/druntime/pull/1740 >> https://github.com/dlang/druntime/pull/1749 >> >> Going forward, I think it would be best for the language if `in` would work as Q. Schroll described here: http://forum.dlang.org/post/medovwjuykzpstnwbfyy@forum.dlang.org. This can also nicely fix the the problems with rvalues (with auto ref you may end with up to 2^N template instantiations where N is the number of parameters and 2 is because you get one by value and one by ref instance; doesn't play nice with delegates etc). See also https://github.com/dlang/dmd/pull/4717. > > Another interesting link: http://dgame.github.io/dneeds/ Thanks for the links. I have to wonder though, does this go further than dormant discussions? Because apparently, when things like that are actively put on the backburner, we have good chances ending up with "too much code would break", and in the end, nothing would be changed, at least for the better. D seems to be gaining momentum, and having things half-working-not-necessarily-as-is-was-intended looks less and less like an acceptable "for the time being" state of affairs. |
May 30, 2017 Re: Should out/ref parameters require the caller to specify out/ref like in C#? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Petar Kirov [ZombineDev] | On 05/30/2017 05:48 AM, Petar Kirov [ZombineDev] wrote:
> On Tuesday, 30 May 2017 at 06:13:39 UTC, Stanislav Blinov wrote:
>> On Tuesday, 30 May 2017 at 02:12:56 UTC, Jonathan M Davis wrote:
>>
>>> That definition currently there is more precise than the definition on that page has been historically...
>>
>> Apparently, it is not. Do you have a reference to Walter's change regarding `in` becoming just `const`? Because a change like that should get reflected in the spec, otherwise we might just continue to ignore said spec and expect our grievances to be "gracefully" resolved later. What I mean is I'd rather see/make the change reflected there...
>
> Unfortunately, `in` was never implemented as `scope const`.
Why would it need to be `const`? Thanks! -- Andrei
|
May 30, 2017 Re: Should out/ref parameters require the caller to specify out/ref like in C#? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Tuesday, 30 May 2017 at 15:59:04 UTC, Andrei Alexandrescu wrote:
> On 05/30/2017 05:48 AM, Petar Kirov [ZombineDev] wrote:
>> On Tuesday, 30 May 2017 at 06:13:39 UTC, Stanislav Blinov wrote:
>>> On Tuesday, 30 May 2017 at 02:12:56 UTC, Jonathan M Davis wrote:
>>>
>>>> That definition currently there is more precise than the definition on that page has been historically...
>>>
>>> Apparently, it is not. Do you have a reference to Walter's change regarding `in` becoming just `const`? ...
>> Unfortunately, `in` was never implemented as `scope const`.
>
> Why would it need to be `const`? Thanks! -- Andrei
What do you mean?
|
May 30, 2017 Re: Should out/ref parameters require the caller to specify out/ref like in C#? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stanislav Blinov | On 05/30/2017 12:11 PM, Stanislav Blinov wrote:
> On Tuesday, 30 May 2017 at 15:59:04 UTC, Andrei Alexandrescu wrote:
>> On 05/30/2017 05:48 AM, Petar Kirov [ZombineDev] wrote:
>>> On Tuesday, 30 May 2017 at 06:13:39 UTC, Stanislav Blinov wrote:
>>>> On Tuesday, 30 May 2017 at 02:12:56 UTC, Jonathan M Davis wrote:
>>>>
>>>>> That definition currently there is more precise than the definition on that page has been historically...
>>>>
>>>> Apparently, it is not. Do you have a reference to Walter's change regarding `in` becoming just `const`? ...
>>> Unfortunately, `in` was never implemented as `scope const`.
>>
>> Why would it need to be `const`? Thanks! -- Andrei
>
> What do you mean?
I think `scope` would be enough. People should still be able to modify the value. -- Andrei
|
May 30, 2017 Re: Should out/ref parameters require the caller to specify out/ref like in C#? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On 05/30/2017 12:19 PM, Andrei Alexandrescu wrote:
> On 05/30/2017 12:11 PM, Stanislav Blinov wrote:
>> On Tuesday, 30 May 2017 at 15:59:04 UTC, Andrei Alexandrescu wrote:
>>> On 05/30/2017 05:48 AM, Petar Kirov [ZombineDev] wrote:
>>>> On Tuesday, 30 May 2017 at 06:13:39 UTC, Stanislav Blinov wrote:
>>>>> On Tuesday, 30 May 2017 at 02:12:56 UTC, Jonathan M Davis wrote:
>>>>>
>>>>>> That definition currently there is more precise than the definition on that page has been historically...
>>>>>
>>>>> Apparently, it is not. Do you have a reference to Walter's change regarding `in` becoming just `const`? ...
>>>> Unfortunately, `in` was never implemented as `scope const`.
>>>
>>> Why would it need to be `const`? Thanks! -- Andrei
>>
>> What do you mean?
>
> I think `scope` would be enough. People should still be able to modify the value. -- Andrei
Oh, I'm in a different movie - thought it's the associative array "in". Sorry! -- Andrei
|
May 30, 2017 Re: Should out/ref parameters require the caller to specify out/ref like in C#? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Tuesday, 30 May 2017 at 16:19:26 UTC, Andrei Alexandrescu wrote: >>>>> Apparently, it is not. Do you have a reference to Walter's change regarding `in` becoming just `const`? ... >>>> Unfortunately, `in` was never implemented as `scope const`. >>> >>> Why would it need to be `const`? Thanks! -- Andrei >> >> What do you mean? > > I think `scope` would be enough. People should still be able to modify the value. -- Andrei I'm puzzled. I was talking about https://dlang.org/spec/function.html#parameters : `in` - `const scope`. Jonathan mentioned that Walter effectively reverted it to `const`. Petar provided links to that effect. Now you're saying it should be simply `scope`? %-O |
May 30, 2017 Re: Should out/ref parameters require the caller to specify out/ref like in C#? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stanislav Blinov | On Tuesday, May 30, 2017 06:13:39 Stanislav Blinov via Digitalmars-d wrote: > On Tuesday, 30 May 2017 at 02:12:56 UTC, Jonathan M Davis wrote: > > That definition currently there is more precise than the definition on that page has been historically... > > Apparently, it is not. Do you have a reference to Walter's change regarding `in` becoming just `const`? Because a change like that should get reflected in the spec, otherwise we might just continue to ignore said spec and expect our grievances to be "gracefully" resolved later. What I mean is I'd rather see/make the change reflected there... There was a thread discussing it here: http://forum.dlang.org/post/zskxjpctdipbqalpwxbj@forum.dlang.org with Walter's main response being here: http://forum.dlang.org/post/o6m17i$1jh7$1@digitalmars.com - Jonathan M Davis |
Copyright © 1999-2021 by the D Language Foundation