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

Guillaume Chatelet chatelet.guillaume at gmail.com
Sun Jun 17 14:47:30 PDT 2012


On 06/17/12 18:38, Andrei Alexandrescu wrote:
> 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.

Yes. As you noticed CoDomain is simply an alias to ReturnType.

The purpose of this thread was to measure the interest of the D
community in going further in this direction. I thought it would be
great to benefit from the work the C++ community has already done in
this domain. Brilliant people are working on it for years and the more
basic Concepts look stable now so it might be a good starting point.

My take on it is that Concept modeling improves in designing and
extending complex generic libraries. As an example see the Generic Image
Library (GIL) by Adobe and now part of Boost.
http://stlab.adobe.com/gil/html/gildesignguide.html

Of course, the idioms being different, I was also looking for some
feedback. I did ask myself what naming convention should be used
considering some traits were already implemented as you pointed out. I
sticked to the D _isXXXX_ convention instead of the plain CamelCase
name. I was tempted to use a _hasValueSemantic_ traits (Concept) instead
of _isRegular_. Also _isPure_ could replace _isFunctionalProcedure_.
Basically this is just a proposal and everything can change at this
point. I'm also not convinced we should add every single Concepts
Stepanov is describing, we have to be pragmatic here.

So what do you think should be the next move ? Try to integrate those
concepts within phobos ? try to add more of them ?

More comments are definitely welcome. Many thanks for everyones feedback.


More information about the Digitalmars-d mailing list