DIP69 - Implement scope for escape proof references

Daniel N via Digitalmars-d digitalmars-d at puremagic.com
Sat Dec 6 02:59:22 PST 2014


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.


More information about the Digitalmars-d mailing list