type variables

Bruce Carneal bcarneal at gmail.com
Sun Aug 2 20:27:53 UTC 2020


On Sunday, 2 August 2020 at 18:21:17 UTC, Paul Backus wrote:
> On Sunday, 2 August 2020 at 17:27:43 UTC, Stefan Koch wrote:
>>
>> How is that easier?
>>
>> It requires you to have a stack, which also means that you 
>> have to keep track of the stack frames in order to execute 
>> this   Iin your head.
>
> To some extent this is a matter of experience and personal 
> taste.
>
> If you are comfortable reading recursive code, it is quite 
> simple to understand a function with a single base case and a 
> single recursive case. There is no need to keep track of 
> individual stack frames in your head.
>
> Perhaps my experience in this regard is different from the rest 
> of the D community? I learned about recursion in my first year 
> of undergraduate education, so I assumed this sort of thing 
> would be considered common knowledge among experienced 
> programmers.

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.





More information about the Digitalmars-d mailing list