TypeFunction example: ImplictConvTargets

Bruce Carneal bcarneal at gmail.com
Tue Oct 6 15:24:31 UTC 2020


On Tuesday, 6 October 2020 at 12:28:55 UTC, Adam D. Ruppe wrote:
> On Tuesday, 6 October 2020 at 08:35:20 UTC, claptrap wrote:
>> Because Stefan didnt rely on external code, he showed *all* 
>> the code needed, so a counter example should have been the 
>> same. Since the point is to compare the two *language* 
>> features, not compare library calls.
>
> Language features are a means to an end.
>
> If the Phobos version compiles faster, uses less memory, and 
> has the same result in the binary, it is a victory, even if it 
> as significantly more code.

I disagree.  I believe we should aim for the simplest code that 
admits the desired performance.  Simplicity is especially 
important at lower levels where the benefits compound.  We're 
working to factor out complexity for today's programmers and 
tomorrows.

>
> I'm skeptical of the type functions, but interested. They might 
> help with a real problem.

Well, what is a "real problem"?  If you mean "something that can 
not be done outside the compiler" then nothing is a real problem 
(note CTFE and mixins).  If you mean "something that can not be 
done near optimally outside the compiler" then we're in violent 
agreement.

> But they need to actually win on the end results, not against 
> artificial strawmen.

Agree.

Note that performance is relatively easy to test whereas it's 
harder to compare aggregate debugability over time.  My proxies 
include readability, teachability, independence (fewer layers, 
fewer dependencies), and the amount of the correctness "proof" 
(debugging) handled automatically.

If performance is similar we should opt for better aggregate 
debugability as we, the community, understand it.  My current 
understanding is that type functions are significantly better in 
this regard.

Finally, please note that while I disagree with you on some 
particulars here I am a big fan.  I enjoyed your book, and admire 
the tremendous amount of cheerful quality help that you offer in 
the forums and discord.













More information about the Digitalmars-d mailing list