www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1293] New: D needs first class tuples

reply d-bugmail puremagic.com writes:

           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):


Jun 26 2007
parent d-bugmail puremagic.com writes:

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;

Jul 17 2007