Thread overview | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
December 11, 2009 [Issue 3608] New: Allow isExpression and templates to capture template parameters and FQN of template | ||||
---|---|---|---|---|
| ||||
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: ------- |
November 08, 2010 [Issue 3608] Allow isExpression and templates to capture template parameters and FQN of template | ||||
---|---|---|---|---|
| ||||
Posted in reply to Simen Kjaeraas | 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: ------- |
November 08, 2010 [Issue 3608] Allow isExpression and templates to capture template parameters and FQN of template | ||||
---|---|---|---|---|
| ||||
Posted in reply to Simen Kjaeraas | 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: ------- |
November 08, 2010 [Issue 3608] Allow isExpression and templates to capture template parameters and FQN of template | ||||
---|---|---|---|---|
| ||||
Posted in reply to Simen Kjaeraas | 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: ------- |
November 08, 2010 [Issue 3608] Allow isExpression and templates to capture template parameters and FQN of template | ||||
---|---|---|---|---|
| ||||
Posted in reply to Simen Kjaeraas | 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: ------- |
May 20, 2012 [Issue 3608] Allow isExpression and templates to capture template parameters and FQN of template | ||||
---|---|---|---|---|
| ||||
Posted in reply to Simen Kjaeraas | http://d.puremagic.com/issues/show_bug.cgi?id=3608 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull, rejects-valid --- Comment #5 from Kenji Hara <k.hara.pg@gmail.com> 2012-05-20 09:51:48 PDT --- https://github.com/D-Programming-Language/dmd/pull/958 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 20, 2012 [Issue 3608] Allow isExpression and templates to capture template parameters and FQN of template | ||||
---|---|---|---|---|
| ||||
Posted in reply to Simen Kjaeraas | http://d.puremagic.com/issues/show_bug.cgi?id=3608 --- Comment #6 from github-bugzilla@puremagic.com 2012-05-20 12:48:06 PDT --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/b327dd61e685c85adfdceef0767b4a456350667b fix Issue 3608 - Allow isExpression and templates to capture template parameters and FQN of template https://github.com/D-Programming-Language/dmd/commit/ed68238cd1e5a7aec454840ee11e04580f974855 Merge pull request #958 from 9rnsr/fix_tided Issue 1780 & 3608 & 8125 - Fix TypeInstance deduction problems -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 20, 2012 [Issue 3608] Allow isExpression and templates to capture template parameters and FQN of template | ||||
---|---|---|---|---|
| ||||
Posted in reply to Simen Kjaeraas | http://d.puremagic.com/issues/show_bug.cgi?id=3608 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation