DIP69 - Implement scope for escape proof references
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Mon Dec 15 16:58:20 PST 2014
On 12/15/2014 1:28 AM, Dicebot wrote:
> On Monday, 15 December 2014 at 06:12:05 UTC, Walter Bright wrote:
>> C++ seems to do fine without it for const. It's a convenience feature.
>
> C++ const does not really restrict or affect anything "for real", it is
> non-existent feature.
C++ programmers constantly copy/pasta functions for the sole purpose of having
one with const and one without.
> `scope` as proposed would result in inability to store
> result of predicates if those are ever to accept scope data - unless you defined
> two versions for each function that may possibly accept scope data with
> absolutely identical body.
If that is necessary, it is no worse than C++ is with const. It isn't a critical
issue, or C++ would not be usable. I'd like to wait and see how this plays out.
>>>> 2. This is what scope inference is all about.
>>>
>>> Which only works with templates and lack of scope on arguments does not affect
>>> function body -> templates are not necessary, same as inout.
>>
>> It also works with all the lambdas, since source for them is always available.
>> I also wanted to make it (i.e. inference) work with auto functions, but Don
>> Clugston was the primary objector :-)
>
> This is not really answering my objections but side-stepping.
Inference addresses the issue.
> That would help with many issues but it need careful design to be well-accepted.
> How about teaming up to do a DIP about it at some point where this discussion is
> over? :P
Ok, sure.
More information about the Digitalmars-d
mailing list