Completing C code with D style

forkit forkit at gmail.com
Fri Nov 12 02:00:40 UTC 2021


On Friday, 12 November 2021 at 01:05:15 UTC, Stanislav Blinov 
wrote:
> On Thursday, 11 November 2021 at 22:10:04 UTC, forkit wrote:
>
>> It's called 'staged learning'.
>>
>> Staged learning is the only way for humans to learn, due to 
>> the limitations of the human cognitive system. Specifically, 
>> the way short-term memory and long-term memory facilitate 
>> learning.
>>
>> Those who lack this understanding of how humans learn, tend to 
>> throw too much at novices.
>
> Like making a simple program do a bunch of extra work for 
> literally no reason?
>
>> Also, this apparent drive towards requiring novices to 
>> understand the implications of their code, in terms of 
>> optimising the assembly that gets produced, is just nonsense. 
>> They'll never get pass the for loop!
>
> This has nothing to do with "optimising the assembly".

also, I think it's important not to conflate, code that doesn't 
perform well, with code that is not optimal.

it doesn't take very long as a developer, before you realise 
nobodys likes slow software ;-)  so performance will ALWAYS be 
front of mind, once you reach that point.

We don't need people telling us your code needs to written so 
that it performs well.

But even fast software is not necessarily optimised, and likely 
far from it in many scenarios... and getting worse it seems... 
which is ok, as long as faster devices keep rolling out I guess..

most people are developers (incl me), not programmers per se, and 
don't have the time to understand the ins and outs of how code 
executes on hardware, and how one library finction interacts with 
another.....etc... and so are not really in a position to 
optimise it. They are more interested in ensuring the solution 
they give to their users is not slow. That's what matters to 
them, and their users.

An app that use 3GB of your memory, when (if optimised) really 
could reduce that to 1GB, sounds great, in principle. But what 
effect will that optimised code have in terms of bugs and 
maintainance? So there are tradeoffs that do genuiely need to be 
considered, and circumstances differ.

btw. None of the solutions in this thread are slow..not by any 
means... and its certainly likely that none are optimal.

Hopefully the compiler and library are doing their very best to 
make it optimal ;-)





More information about the Digitalmars-d-learn mailing list