digitalmars.D.bugs - [Issue 4639] New: Built-in primitive types cannot be used as template alias parameters
- d-bugmail puremagic.com (27/27) Aug 13 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4639
- d-bugmail puremagic.com (17/17) Aug 13 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4639
- d-bugmail puremagic.com (15/22) Aug 13 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4639
- d-bugmail puremagic.com (8/26) Aug 13 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4639
- d-bugmail puremagic.com (7/7) Aug 13 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4639
- d-bugmail puremagic.com (18/18) Aug 13 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4639
- d-bugmail puremagic.com (15/24) Aug 13 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4639
- d-bugmail puremagic.com (9/12) Aug 13 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4639
- d-bugmail puremagic.com (12/12) Aug 14 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4639
http://d.puremagic.com/issues/show_bug.cgi?id=4639
Summary: Built-in primitive types cannot be used as template
alias parameters
Product: D
Version: D2
Platform: Other
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: asitdepends gmail.com
---
import std.stdio;
template T(alias X) {
}
void main() {
writeln(typeid(typeof(T!int)));
}
dmd 2.048 on linux produces an error for the above code.
Error: template instance T!(int) does not match template declaration T(alias X)
Built-in primitive types cannot be used as template alias parameters. Structs
and classes work well.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 13 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4639
Don <clugdbug yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |clugdbug yahoo.com.au
Resolution| |INVALID
This is not a bug. From the spec:
"Alias parameters enable templates to be parameterized with any type of D
symbol, including global names, local names, typedef names, module names,
template names, and template instance names. Literals can also be used as
arguments to alias parameters."
Built-in types are not on that list.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 13 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4639 ---This is not a bug. From the spec: "Alias parameters enable templates to be parameterized with any type of D symbol, including global names, local names, typedef names, module names, template names, and template instance names. Literals can also be used as arguments to alias parameters." Built-in types are not on that list.Hmm.. I don't think so. "parameterized with any type of D symbol, including ..." Why are not built-in primitive types included in "any type of D symbol"? Is there any particular reason that user defined type names (like struct names) are allowed but built-in type names are not allowed? I think such a limitation is not natural. IMHO, If there is any good reason for the limitation, the phrase "any type of D symbol" should be removed from the spec. If there are no such reasons, then this should be considered as a bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 13 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4639I basically agree with you, but syntactically, they are quite different, and it's an intentional decision by Walter. See for example bug 1341. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------This is not a bug. From the spec: "Alias parameters enable templates to be parameterized with any type of D symbol, including global names, local names, typedef names, module names, template names, and template instance names. Literals can also be used as arguments to alias parameters." Built-in types are not on that list.Hmm.. I don't think so. "parameterized with any type of D symbol, including ..." Why are not built-in primitive types included in "any type of D symbol"? Is there any particular reason that user defined type names (like struct names) are allowed but built-in type names are not allowed? I think such a limitation is not natural.
Aug 13 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4639 --- Still I could not get the reason. So, I posted a message to the mailing list to discuss this. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 13 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4639
nfxjfg gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
CC| |nfxjfg gmail.com
Version|D2 |D1 & D2
Resolution|INVALID |
This spec is way to sh... I mean incomplete to interpret it literally. Also it
is known that the spec is downright incorrect in many cases. I don't know why
you would close this bug as invalid just because of the spec text. Also it's
very inconsistent to exclude built-in types. About it being intentional by
Walter: he actually fixed the mentioned bug 1341 and didn't close it as
invalid. Finally, it's a D1 problem too.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 13 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4639
Don <clugdbug yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution| |INVALID
It's exactly the same issue as: typeof(int) is not legal.(In reply to comment
This spec is way to sh... I mean incomplete to interpret it literally. Also it
is known that the spec is downright incorrect in many cases. I don't know why
you would close this bug as invalid just because of the spec text.
NO. I requested Walter to make this change, and he rejected this before. It is
definitely NOT a bug. A built-in type is not a D symbol.
Also it's
very inconsistent to exclude built-in types. About it being intentional by
Walter: he actually fixed the mentioned bug 1341 and didn't close it as
invalid.
No, *I* changed the description of the bug after discussion with Walter. It was
originally "typeof(int) should probably be legal".
Finally, it's a D1 problem too.
No it isn't. It's an enhancement which would break existing code.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 13 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4639NO. I requested Walter to make this change, and he rejected this before. It is definitely NOT a bug. A built-in type is not a D symbol.That's seriously stupid. Just another un-orthogonal feature that causes programmers headaches?No it isn't. It's an enhancement which would break existing code.How? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 13 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4639
Max Samukha <samukha voliacable.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |samukha voliacable.com
PDT ---
I can't believe the limitation is deliberate. Please remove it if technically
possible. Now the poor coder is forced to practice nonsense like:
template Foo(A...) if (A.length == 1) {}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 14 2010









d-bugmail puremagic.com 