Proposal to add 'Elements of Programming' Concepts to std.traits

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Jun 17 09:38:21 PDT 2012


On 6/16/12 10:26 AM, Guillaume Chatelet wrote:
> 'Elements of Programming' is an amazing book by Alexander Stepanov and
> Paul McJones ( M. Stepanov is the primary designer of the C++ STL ).
[snip]
> So without further ado, here is my humble first attempt
> https://github.com/gchatelet/phobos/blob/traits_concepts/std/traits2.d
> And the associated more readable DDoc
> http://bbteam.fr/traits2.html
>
> I would like to hear what you think.

This is a good idea because the traits are useful within and outside the 
algorithms discussed in EoP.

However, I don't think we need to abide strictly to the nomenclature 
(e.g. some of the stuff in EoP was already defined with a different 
name) although some EoP names are more mathematicky (such as "Codomain" 
vs. "ReturnType"). One issue is when EoP goes off and defines its own 
terms such as "regular type", which is usually known as "value type". In 
fact, "regular type" means something completely different in PL 
research. EoP's terminology didn't catch up outside C++ and sometimes 
outside a small group within it.

If I'm allowed to venture an opinion on EoP itself, it's an interesting 
book but I don't find it as big or great as some of its fans believe. 
It's not breaking any new ground, instead it explores more along already 
well-trodden territory, and it fails to find new mother lodes. Some 
(many?) chapters (such as transformations and orbits) describe some 
self-important notions but fail to demonstrate their general 
applicability. Nevertheless, the code really is exquisitely written, and 
studying it has significantly changed my approach and style in 
implementing algorithms.


Andrei


More information about the Digitalmars-d mailing list