[RFC] Modules for template programming proposal
Denis Shelomovskij
verylonglogin.reg at gmail.com
Sun Nov 25 22:16:42 PST 2012
Currently there is a lack of meta features in D standard library.
So the following modules are proposed for inclusion in Phobos.
http://denis-sh.github.com/phobos-additions/unstd.templates.html
Major features:
* instantiate template
A convenience util to instantiate templates needed because of D
syntax issues.
NOTE: already in Phobos but with inexcusable long name for such
common used D syntax issue workaround.
* create template from string
* bind template arguments
* combine template predicates
NOTE: partially already in Phobos's std.typetuple but with worse
(IMHO) names and with at least incorrect `notTemplate` analogue.
http://denis-sh.github.com/phobos-additions/unstd.generictuple.html
Major features:
* generic tuple general templates
There should be at least both GenericTuple and TypeTuple as the
latter is a common use case of generic tuples. E.g. TypeTuple is used
~70% of generic tuple usage in Phobos.
* packed generic tuple templates
Useful when passing more than one generic tuple to a template.
* generic tuple creation templates
Templates for generic tuple creation by analogy with range creation
functions from std.range.
* generic tuple algorithm templates
Templates for various algorithms on generic tuples by analogy with
range algorithm functions from std.algorithm.
IMHO, it will be very convenient to make generic tuple processing
functions by analogy with range processing as it will allow user to
learn only one functions set for both runtime and template programming.
Also I don't like the current situation with infinite `std` package grow
and would like to use `std.meta` or just `meta` for these modules.
See also:
* http://denis-sh.github.com/phobos-additions/
the full list of [potential] Phobos proposals
* http://d.puremagic.com/issues/show_bug.cgi?id=3702
Issue 3702 - Replace __traits and is(typeof()) with a 'magic namespace'
--
Денис В. Шеломовский
Denis V. Shelomovskij
More information about the Digitalmars-d
mailing list