digitalmars.D.bugs - [Issue 3608] New: Allow isExpression and templates to capture template parameters and FQN of template
- d-bugmail puremagic.com Dec 11 2009
- d-bugmail puremagic.com Nov 08 2010
- d-bugmail puremagic.com Nov 08 2010
- d-bugmail puremagic.com Nov 08 2010
- d-bugmail puremagic.com Nov 08 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3608 Summary: Allow isExpression and templates to capture template parameters and FQN of template Product: D Version: future Platform: Other OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: simen.kjaras gmail.com --- Comment #0 from Simen Kjaeraas <simen.kjaras gmail.com> 2009-12-11 07:26:57 PST --- Currently, there is no way to extract FQN of a template from an instantiation, nor to get its parameters. This is not completely true, as one could parse its stringof representation, but this is often not enough. I therefore propose that the following syntax be allowed: template foo( T : U!( V ), U, V... ) Thus, one could get the base template or parameters of an instantiation using the following templates: template BaseTemplate( T : U!( V ), U, V... ) { alias U BaseTemplate; } template TemplateParameters( T : U!( V ), U, V... ) { alias V TemplateParameters; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 11 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3608 Simen Kjaeraas <simen.kjaras gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|future |D2 Severity|enhancement |normal --- Comment #1 from Simen Kjaeraas <simen.kjaras gmail.com> 2010-11-08 05:21:14 PST --- Judging by the recent resolution of bug 1714, this is not so much an enhancement as a planned feature. Updating the syntax: template foo( T : U!V, alias U, V... ) { //... } template BaseTemplate( T : U!( V ), alias U, V... ) { alias U BaseTemplate; } template TemplateParameters( T : U!( V ), alias U, V... ) { alias V TemplateParameters; } This may be a separate bug, as it concerns variadic parameter lists, something bug 1714 fails to take into account. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 08 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3608 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug yahoo.com.au --- Comment #2 from Don <clugdbug yahoo.com.au> 2010-11-08 06:22:55 PST --- The patch in bug 5614 fixes some issues which seem similar to these. But I'm not sure what these test cases are supposed to do. It seems to be an attempt to use IFTI, but note that IFTI only applies to function templates. But type deduction can also be used in is() expressions. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 08 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3608 --- Comment #3 from Simen Kjaeraas <simen.kjaras gmail.com> 2010-11-08 07:00:15 PST --- I'm not sure what it is that confuses you. D allows constraints to be placed on template parameters not only by means of template constraints, but also isExpression-like patterns in the parameter list: class A {} class B : A {} template isAnA( T : A ) { enum isAnA = true; } static assert( isAnA!B ); This also works for more complex type constraints: template extractTupleArgs( T == Tuple!U, U... ) { alias U extractTupleArgs; } static assert( is( extractTupleArgs!( Tuple!int ) == int ) ); It does however not work for complex type constraints where the template is not known: template dissectTemplate( T == U!V, V... ) { alias U tmpl; alias V args; } And it is this last case I want covered. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 08 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3608 --- Comment #4 from Simen Kjaeraas <simen.kjaras gmail.com> 2010-11-08 07:02:15 PST --- (In reply to comment #3)template dissectTemplate( T == U!V, V... ) {
This should of course be template dissectTemplate( T == U!V, alias U, V... ) { -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 08 2010









d-bugmail puremagic.com 