no-autodecode -- game plan

Andrei Alexandrescu SeeWebsiteForEmail at erdani.com
Wed Aug 19 16:20:33 UTC 2020


On 8/19/20 10:27 AM, Timon Gehr wrote:
> On 19.08.20 15:10, Andrei Alexandrescu wrote:
>>>
>>
>> Don't copy everything, alias everything that doesn't need change and 
>> only add the declarations that should be changed.
> 
> But which declarations are those? Aliasing declarations that would 
> otherwise be copied verbatim does not work. Consider:
> 
> module a;
> 
> auto front(R)(R r)if(...){ /* autodecode here */ }
> auto algorithm(R)(R r)if(...){ ... r.front; ... }
> 
> module b;
> 
> auto front(R)(R r)if(...){ /* no autodecode here */
> static import a;
> alias algorithm=a.algorithm;
> 
> This will not do what you want, because aliasing is not equivalent to 
> copying.

Of course, that was implied. The difficulty is to figure whether said 
algorithm (and others) would be affected by autodecoding, even if it 
doesn't in and of itself do anything about it specifically. Those that 
are would need to be forked across the two versions. Ideally instead of 
copying them, they'd be separated to minimize duplication.



More information about the Digitalmars-d mailing list