type variables

Stefan Koch uplink.coder at googlemail.com
Sun Aug 2 23:04:45 UTC 2020


On Sunday, 2 August 2020 at 20:42:35 UTC, Paul Backus wrote:
> On Sunday, 2 August 2020 at 20:27:53 UTC, Bruce Carneal wrote:
>>
>> I think it's all about readability given the performance 
>> constraints.
>>
>> Your type function example earlier in this thread employs 
>> iteration and is dead simple.  Not much to improve there.
>
> You're conflating two separate issues. The existing alternative 
> to using a TypeBuilder + iteration is `static foreach`--which 
> is also iterative.
>
> The question you should answer, if you want to convince people 
> that TypeBuilder (or something like it) is worth adding, is 
> "how is this better than `static foreach` and `static if`?"

static foreach and static if come with
compile time performance prices to pay.

it comes down to having to do semantic processing in a piece-wise 
fashion multiple times.

The type function approach I am working on does semantic 
processing of invariant parts only once.

Whereas the static foreach body cannot know about invariant 
regions, (that's a general statement (in special cases it might 
be possible to implement such awareness (I would not advise it 
however)))


More information about the Digitalmars-d mailing list