June 26, 2007 [Issue 1293] New: D needs first class tuples | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=1293 Summary: D needs first class tuples Product: D Version: 1.016 Platform: Other OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: onlystupidspamhere@yahoo.se There has been discussion in the NG about removing the hackish C/C++ style comma operations from the grammar or at least moving them from the general expression level to the areas where they are mostly used. The old style sequencing could be preserved in e.g. for loops. The gap can be easily filled with tuple literals. One proposed syntax for literals is (elem1, ..., elemn) The syntax could be used for unifying similar concepts that are currently similar, but distinct. Possible uses include but are not limited to: 1) function return types, arguments and parameters (e.g. #538) 2) explicit parametric polymorphism (i.e. templates) 3) declaration and assignment statements (e.g. #1288) This unification might also help solving bugs like #1064. ---- Example thread from the ng (I'm sure there are more of them): http://www.digitalmars.com/d/archives/digitalmars/D/learn/Tuple_mixins_7701.html -- |
July 17, 2007 [Issue 1293] D needs first class tuples | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1293 shro8822@vandals.uidaho.edu changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |shro8822@vandals.uidaho.edu ------- Comment #1 from shro8822@vandals.uidaho.edu 2007-07-17 11:56 ------- another case where is would help is this: template Types(A...) { template Values(A a) { } } alias Types!(int, bool, int[]).Values!(1,true,[1,2,3]) bob; -- |
Copyright © 1999-2021 by the D Language Foundation