DIP69 - Implement scope for escape proof references

via Digitalmars-d digitalmars-d at puremagic.com
Sat Dec 6 04:58:02 PST 2014


On Saturday, 6 December 2014 at 10:59:24 UTC, Daniel N wrote:
> On Friday, 5 December 2014 at 16:48:45 UTC, Marc Schütz wrote:
>> There are limitations this proposal has in comparison to my 
>> original one. These limitations might of course be harmless 
>> and play no role in practice, but on the other hand, they may, 
>> so I think it's good to list them here.
>>
>
> One concern I had with your proposal was that it refers to a 
> symbol before it's available.
>
> scope!haystack(string) findSubstring(scope(string) haystack, 
> scope(string) needle)
>
> C++11 had similar issues and they solved it by introducing 
> trailing return types.
>
> ex:
> "template<class T>
> auto mul(T a, T b) -> decltype(a*b)"
>
> Personally I would prefer not to go down that lane and DIP69 
> avoids that problem.

For D, this wouldn't be necessary, because parsing and semantic 
analysis are strictly separated. The owners would only have to be 
evaluated very late during the semantic phase.

But let's see how DIP69 works out...


More information about the Digitalmars-d mailing list