Proposal: struct and array literal syntax

Andrei Khropov andkhropov at nospam_mtu-net.ru
Fri Jun 23 02:08:47 PDT 2006


Boris Wang wrote:

> 
> "Andrei Khropov" <andkhropov at nospam_mtu-net.ru>
> P4HkO{O"PBNE:e7b7fb$277d$1 at digitaldaemon.com...
> > Derek Parnell wrote:
> > 
> > > Now a 'rectangular' array ...
> > > 
> >>  int[][]![
> >>      int[]![1,2,3,4],
> >>      int[]![5,6,7,8],
> >>      int[]![9,0,1,2],
> >>      int[]![3,4,5,6],
> >>    ]
> > > 
> > > Hmmm ... appears to do okay.
> > Well, in the last case inner int[]! s appear to be a syntactic overhead.
> > 
> > I'm still waiting for better handling of multidimensional rectangular
> > arrays (not less effective "jagged").
> > 
> > --  AKhropov
> > 
> 
> May be:
> 
> int[][]![
>     ![1,2,3,4],
>     ![5,6,7,8],
>     ![9,0,1,2],
>     ![3,4,5,6],
> ]
> 
> the type of ![1,2,3,4] can be inferred.

In the spirit of the recent type inference extensions the outer type should be
inferred also: just

![
    ![1,2,3,4],
    ![5,6,7,8],
    ![9,0,1,2],
    ![3,4,5,6]
]

-- 
AKhropov



More information about the Digitalmars-d mailing list