Jump to page: 1 24  
Page
Thread overview
DMD 1.014 release
Apr 27, 2007
Walter Bright
Apr 27, 2007
Sean Kelly
Apr 27, 2007
eao197
Apr 27, 2007
bobef
Apr 27, 2007
Frits van Bommel
Apr 27, 2007
bobef
Apr 27, 2007
Don Clugston
Apr 27, 2007
BCS
May 06, 2007
Georg Wrede
Apr 27, 2007
renoX
Apr 27, 2007
torhu
Apr 27, 2007
Don Clugston
Apr 27, 2007
Tom
Apr 27, 2007
Frits van Bommel
Apr 27, 2007
Tom
Re: DMD 1.014 release (struct literal syntax and keywords)
May 01, 2007
Bill Baxter
Apr 27, 2007
Pragma
Apr 27, 2007
BCS
Apr 27, 2007
Pragma
Apr 27, 2007
BCS
Apr 27, 2007
Pragma
Apr 27, 2007
Tom S
Apr 27, 2007
Clay Smith
Apr 27, 2007
F
Apr 29, 2007
kenny
D Doc diffs (Re: DMD 1.014 release)
May 01, 2007
Bruno Medeiros
May 01, 2007
Bruno Medeiros
May 01, 2007
Frits van Bommel
May 01, 2007
Walter Bright
May 01, 2007
Frits van Bommel
May 13, 2007
gareis
April 27, 2007
Sports associative array literals, and struct literals. This enables compile time function execution to work with symbol tables (AA's) and user defined types.

http://www.digitalmars.com/d/changelog.html

http://ftp.digitalmars.com/dmd.1.014.zip
April 27, 2007
Walter Bright wrote:
> Sports associative array literals, and struct literals. This enables compile time function execution to work with symbol tables (AA's) and user defined types.

Nice work!


Sean
April 27, 2007
On Fri, 27 Apr 2007 11:42:22 +0400, Walter Bright <newshound1@digitalmars.com> wrote:

> Sports associative array literals, and struct literals. This enables compile time function execution to work with symbol tables (AA's) and user defined types.

Wow! Thanks!

> http://www.digitalmars.com/d/changelog.html

Date of D.1.014 release is 2007.04.20 in ChangeLog.

-- 
Regards,
Yauheni Akhotnikau
April 27, 2007
this class member:

static auto allsupportedfiles2=["avi":1,"mpg":1,"mpeg":1,"asf":1,"asx":1,"dat":1,"vob":1,"ifo":1,"wma":1,"wmv":1,"mov":1,"qt":1,"mp4":1,"fli":1,"rm":1,"nuv":1,"ogg":1,"ogm":1,"sdp":1,"pva":1,"roq":1,"flm":1,"cpk":1,"vivo":1,"mkv":1,"mp3":1,"mpe":1,"divx":1,"mpv":1,"m1v":1,"m2v":1,"dv":1,"m4v":1,"264":1,"mp1":1,"mp2":1,"mpa":1,"ac3":1,"m4a":1,"26l":1,"jsv":1,"wav":1/*,"rpl"*/,"flv":1];

app.d(126): Error: cannot infer type from this array initializer

static bool[char[]] allsupportedfiles2=["avi":1,"mpg":1,"mpeg":1,"asf":1,"asx":1,"dat":1,"vob":1,"ifo":1,"wma":1,"wmv":1,"mov":1,"qt":1,"mp4":1,"fli":1,"rm":1,"nuv":1,"ogg":1,"ogm":1,"sdp":1,"pva":1,"roq":1,"flm":1,"cpk":1,"vivo":1,"mkv":1,"mp3":1,"mpe":1,"divx":1,"mpv":1,"m1v":1,"m2v":1,"dv":1,"m4v":1,"264":1,"mp1":1,"mp2":1,"mpa":1,"ac3":1,"m4a":1,"26l":1,"jsv":1,"wav":1/*,"rpl"*/,"flv":1];

app.d(126): Error: cannot use array to initialize bool[char[]]


why?

Walter Bright Wrote:

> Sports associative array literals, and struct literals. This enables compile time function execution to work with symbol tables (AA's) and user defined types.
> 
> http://www.digitalmars.com/d/changelog.html
> 
> http://ftp.digitalmars.com/dmd.1.014.zip

April 27, 2007
Walter Bright wrote:
> Sports associative array literals, and struct literals. This enables compile time function execution to work with symbol tables (AA's) and user defined types.
> 
> http://www.digitalmars.com/d/changelog.html
> 
> http://ftp.digitalmars.com/dmd.1.014.zip

Woohoo!! Thanks, Walter. This is gonna be fun.
April 27, 2007
bobef wrote:
> this class member:
> 
> static auto allsupportedfiles2=["avi":1,"mpg":1,"mpeg":1,"asf":1,"asx":1,"dat":1,"vob":1,"ifo":1,"wma":1,"wmv":1,"mov":1,"qt":1,"mp4":1,"fli":1,"rm":1,"nuv":1,"ogg":1,"ogm":1,"sdp":1,"pva":1,"roq":1,"flm":1,"cpk":1,"vivo":1,"mkv":1,"mp3":1,"mpe":1,"divx":1,"mpv":1,"m1v":1,"m2v":1,"dv":1,"m4v":1,"264":1,"mp1":1,"mp2":1,"mpa":1,"ac3":1,"m4a":1,"26l":1,"jsv":1,"wav":1/*,"rpl"*/,"flv":1];
> 
> app.d(126): Error: cannot infer type from this array initializer
> 
> static bool[char[]] allsupportedfiles2=["avi":1,"mpg":1,"mpeg":1,"asf":1,"asx":1,"dat":1,"vob":1,"ifo":1,"wma":1,"wmv":1,"mov":1,"qt":1,"mp4":1,"fli":1,"rm":1,"nuv":1,"ogg":1,"ogm":1,"sdp":1,"pva":1,"roq":1,"flm":1,"cpk":1,"vivo":1,"mkv":1,"mp3":1,"mpe":1,"divx":1,"mpv":1,"m1v":1,"m2v":1,"dv":1,"m4v":1,"264":1,"mp1":1,"mp2":1,"mpa":1,"ac3":1,"m4a":1,"26l":1,"jsv":1,"wav":1/*,"rpl"*/,"flv":1];
> 
> app.d(126): Error: cannot use array to initialize bool[char[]]
> 
> 
> why?

I guess that's what this sentence in the docs means:
=====
An AssocArrayLiteral cannot be used to statically initialize anything.
=====
(Note: The docs aren't up on the site yet, but you can find this in dmd/html/d/expression.html#AssocArrayLiteral)

The error message could be clearer.
April 27, 2007
Oops... My bad then, sorry.

Frits van Bommel Wrote:

> bobef wrote:
> > this class member:
> > 
> > static auto allsupportedfiles2=["avi":1,"mpg":1,"mpeg":1,"asf":1,"asx":1,"dat":1,"vob":1,"ifo":1,"wma":1,"wmv":1,"mov":1,"qt":1,"mp4":1,"fli":1,"rm":1,"nuv":1,"ogg":1,"ogm":1,"sdp":1,"pva":1,"roq":1,"flm":1,"cpk":1,"vivo":1,"mkv":1,"mp3":1,"mpe":1,"divx":1,"mpv":1,"m1v":1,"m2v":1,"dv":1,"m4v":1,"264":1,"mp1":1,"mp2":1,"mpa":1,"ac3":1,"m4a":1,"26l":1,"jsv":1,"wav":1/*,"rpl"*/,"flv":1];
> > 
> > app.d(126): Error: cannot infer type from this array initializer
> > 
> > static bool[char[]] allsupportedfiles2=["avi":1,"mpg":1,"mpeg":1,"asf":1,"asx":1,"dat":1,"vob":1,"ifo":1,"wma":1,"wmv":1,"mov":1,"qt":1,"mp4":1,"fli":1,"rm":1,"nuv":1,"ogg":1,"ogm":1,"sdp":1,"pva":1,"roq":1,"flm":1,"cpk":1,"vivo":1,"mkv":1,"mp3":1,"mpe":1,"divx":1,"mpv":1,"m1v":1,"m2v":1,"dv":1,"m4v":1,"264":1,"mp1":1,"mp2":1,"mpa":1,"ac3":1,"m4a":1,"26l":1,"jsv":1,"wav":1/*,"rpl"*/,"flv":1];
> > 
> > app.d(126): Error: cannot use array to initialize bool[char[]]
> > 
> > 
> > why?
> 
> I guess that's what this sentence in the docs means:
> =====
> An AssocArrayLiteral cannot be used to statically initialize anything.
> =====
> (Note: The docs aren't up on the site yet, but you can find this in
> dmd/html/d/expression.html#AssocArrayLiteral)
> 
> The error message could be clearer.

April 27, 2007
> Frits van Bommel Wrote:
> 
>> bobef wrote:
>>> this class member:
>>>
>>> static auto allsupportedfiles2=["avi":1,"mpg":1,"mpeg":1,"asf":1,"asx":1,"dat":1,"vob":1,"ifo":1,"wma":1,"wmv":1,"mov":1,"qt":1,"mp4":1,"fli":1,"rm":1,"nuv":1,"ogg":1,"ogm":1,"sdp":1,"pva":1,"roq":1,"flm":1,"cpk":1,"vivo":1,"mkv":1,"mp3":1,"mpe":1,"divx":1,"mpv":1,"m1v":1,"m2v":1,"dv":1,"m4v":1,"264":1,"mp1":1,"mp2":1,"mpa":1,"ac3":1,"m4a":1,"26l":1,"jsv":1,"wav":1/*,"rpl"*/,"flv":1];
>>>
>>> app.d(126): Error: cannot infer type from this array initializer
>>>
>>> static bool[char[]] allsupportedfiles2=["avi":1,"mpg":1,"mpeg":1,"asf":1,"asx":1,"dat":1,"vob":1,"ifo":1,"wma":1,"wmv":1,"mov":1,"qt":1,"mp4":1,"fli":1,"rm":1,"nuv":1,"ogg":1,"ogm":1,"sdp":1,"pva":1,"roq":1,"flm":1,"cpk":1,"vivo":1,"mkv":1,"mp3":1,"mpe":1,"divx":1,"mpv":1,"m1v":1,"m2v":1,"dv":1,"m4v":1,"264":1,"mp1":1,"mp2":1,"mpa":1,"ac3":1,"m4a":1,"26l":1,"jsv":1,"wav":1/*,"rpl"*/,"flv":1];
>>>
>>> app.d(126): Error: cannot use array to initialize bool[char[]]
>>>
>>>
>>> why?
>> I guess that's what this sentence in the docs means:
>> =====
>> An AssocArrayLiteral cannot be used to statically initialize anything.
>> =====
>> (Note: The docs aren't up on the site yet, but you can find this in dmd/html/d/expression.html#AssocArrayLiteral)
>>
>> The error message could be clearer.


In practice, you _can_ have initialized static AAs, provided they are read-only (which is probably the main time you want to supply initializers). The declaration syntax for a read-only AA slightly lacks syntactic sugar, but the syntax for usage is perfect:

char[][uint] symTable() { return [2u:"he",4:"ho",6:"hi"]; }

void main()
{
    for (int k=1; k<=6; ++k) {
        if ((k&1)==0) printf("%.*s\n", symTable[k]);
    }
}

BTW, these read-only AAs are great for eliminating case statements!
------------------
char [] a;
switch(k)
{
case 2: a="he"; break;
case 4: a= "ho"; break;
case 6: a="hum"; break;
}
------------------
becomes:
------------------
char [] a = [2:"he"[], 4:"ho", 6:"hum"][k];
------------------
Which is pretty awesome when you have a lot of trivial cases; ought to generate better code, too.
April 27, 2007
Walter Bright escribió:
> Sports associative array literals, and struct literals. This enables compile time function execution to work with symbol tables (AA's) and user defined types.
> 
> http://www.digitalmars.com/d/changelog.html
> 
> http://ftp.digitalmars.com/dmd.1.014.zip

Bugzilla 1189: Reverse the titles on web pages

Perhaps you miss to reverse the titles on phobos docs?

--
Tom;
(Tomás Rossi)
April 27, 2007
Tom wrote:
> Walter Bright escribió:
>> Sports associative array literals, and struct literals. This enables compile time function execution to work with symbol tables (AA's) and user defined types.
>>
>> http://www.digitalmars.com/d/changelog.html
>>
>> http://ftp.digitalmars.com/dmd.1.014.zip
> 
> Bugzilla 1189: Reverse the titles on web pages
> 
> Perhaps you miss to reverse the titles on phobos docs?

As mentioned before, the new docs don't seem to have been uploaded to the site yet. The docs in the zip are fixed (I just checked).
« First   ‹ Prev
1 2 3 4