Thoughts on versioning

Ali Çehreli acehreli at yahoo.com
Tue Oct 26 01:59:32 UTC 2021


On 10/25/21 6:19 PM, Andrei Alexandrescu wrote:

 > template mismatch(alias the_std)
 > {
 >      import the_std.typecons : Tuple, tuple;
[...]
 > }
[...]
 > About the last point: currently the language does allow passing a
 > package name as an alias, but trying to import the_std.typecons ignores
 > any alias definition and opens the hardcoded path "the_std/typcons.d".

Sorry to stray from the main point but I needed that missing feature in 
the past: "This is a string template parameter but I don't want to use a 
string at call site." (Similar to how non-string uses of opDispatch are 
presented as strings.)

For example, Flag!"foo" does not look good. Instead, I want to say 
Flag!foo. I just thought about the following syntaxes:

a) template mismatch(auto mixin the_std) { /* ... */ }

b) template mismatch(string mixin the_std) { /* ... */ }

c) Something like that

So, at the call site:

   mismatch!std2;

So, the_std parameter would be the string literal "std2", and it would 
be automatically mixed in like a string mixin.

I know that we cannot mixin at that granularity but maybe this is a 
useful idea.

Ali



More information about the Digitalmars-d mailing list