Can we make mixin applications first class at the type level?
Olivier FAURE
couteaubleu at gmail.com
Thu Mar 21 12:22:10 UTC 2019
On Thursday, 21 March 2019 at 11:10:27 UTC, sighoya wrote:
> Awesome. Wouldn't it complicate the grammar of D?,e.g.:
>
> int * p; // does it mean declaring an int or calling * :
> (Type,Type)->(Type,Type)
He could add an additional syntax, eg alias(expr), which would
box expressions in places where the grammar expect a type. So,
this would be forbidden:
type myCustomType(int, string);
myCustomType(42, "foobar")* myVar;
But this would be allowed:
type myCustomType(int, string);
alias(myCustomType(42, "foobar"))* myVar;
(notice the placement of the * in the second version, which is
outside of the alias expression, because a postfix * isn't valid
syntax in an expression)
>>For reasoning about code and hygiene, the use site has to
>>indicate to the programmer that code is being inserted into the
>>current scope, rather than just calling a function.
>
> Hygiene isn't the problem as mixins are semi hygenic, in case
> of collision the collided parts get scoped.
Please make multiple posts when answering different people. Some
people use this forum as a mailing list, and it's generally
expected that each message answers one specific message.
More information about the Digitalmars-d
mailing list