Proposal: struct and array literal syntax

Bruno Medeiros brunodomedeirosATgmail at SPAM.com
Fri Jun 23 12:13:31 PDT 2006


Andrei Khropov wrote:
> 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]
> ]
> 

All this talk makes kinda wish that the ascii tables (and consequently 
the standard keyboards as well) had one more set of brackets, like the 
angle brackets for example 
(http://en.wikipedia.org/wiki/Bracket#Angle_brackets_or_chevrons_.E2.8C.A9.C2.A0.E2.8C.AA), 
used for tuple notation in math. "〈1, 2〉"

A comparison:

<1, 2>
‹1, 2›
«1, 2»
〈1, 2〉 // Why do these take two spaces?
《1, 2》

-- 
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list