Compile time values & implicit conditional mixin, as an alternative to tertiary operator hell and one-compile-time functions.
Paul
paultjeadriaanse at gmail.com
Wed Jan 20 14:43:15 UTC 2021
On Sunday, 17 January 2021 at 15:59:31 UTC, Paul wrote:
> - compile time only variables (or functions*), as manifest
> constants cant be modified and normal variables are not useable
> inside mixins:
>> compile string waardes = "waarde.x";
>> static if(L>=2) waardes ~= ",waarde.y";
>> static if(L>=3) waardes ~= ",waarde.z";
>> static if(L==4) waardes ~= ",waarde.w";
&
> On Sunday, 17 January 2021 at 01:51:21 UTC, Paul Backus wrote:
>> Why add a dedicated new language feature if you can get the
>> same behavior "for free" using regular old functions together
>> with CTFE? D is already a pretty complex language, after all.
>
> Because the alternative seems more complex to me.
> It could be a lot more consistent as well, the way the keyword
> 'static' is used at the moment seems very inconsistent to me,
> the same could be said for manifest constants I think.
> (Referring to static if, static foreach, static assert instead
> of static attributes)
>
> Having a single keyword for all, with added expressiveness,
> seems a lot clearner & simpler to me.
If I wanted to make this into a serious language suggestion, how
should I?
Does this require a DIP, or does it make sense to first start a
discussion post solely about this topic? Am I even being
realistic here, I have no idea ":\
More information about the Digitalmars-d
mailing list