August 17, 2001 array initialization in a strongly typed language | ||||
---|---|---|---|---|
| ||||
The design of the language is very strongly typed. void x() being a
prominent example. (the lack of C/C++'s second 'void')
However, the syntax of a complete array initialization seems to break this trend.
array[] = 0x0; // Fill an array with NULLs.
I wonder if an alternative is possible? I worked in languages previously where, essentially, the syntax:
array[0..array.length] = 0x0; // Fill an array with NULLs.
could be shortened to:
array[0..$] = 0x0; // Fill an array with NULLs.
I wonder if something like the "$" symbol could be added to D...
Scott.
--
jabber:quad@jabber.org - Universal ID (www.jabber.org) http://dsn.itgo.com/ - Personal webpage robhome.dyndns.org - Home firewall
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GAT dpu s: a--- C++ UL+++ P++ L+++ E- W++ N+ o+ K w
O M V- PS+ PE Y+ PGP+++ t++ 5 X R tv b++++ DI++++ D++
G+ e+ h! r- y
------END GEEK CODE BLOCK------
|
August 18, 2001 Re: array initialization in a strongly typed language | ||||
---|---|---|---|---|
| ||||
Posted in reply to Scott Robinson | It should be:
array[] = null;
Scott Robinson wrote in message ...
>The design of the language is very strongly typed. void x() being a
>prominent example. (the lack of C/C++'s second 'void')
>
>However, the syntax of a complete array initialization seems to break this trend.
>
> array[] = 0x0; // Fill an array with NULLs.
>
>I wonder if an alternative is possible? I worked in languages previously where, essentially, the syntax:
>
> array[0..array.length] = 0x0; // Fill an array with NULLs.
>
>could be shortened to:
>
> array[0..$] = 0x0; // Fill an array with NULLs.
>
>I wonder if something like the "$" symbol could be added to D...
>
>Scott.
>
>--
>jabber:quad@jabber.org - Universal ID (www.jabber.org) http://dsn.itgo.com/ - Personal webpage robhome.dyndns.org - Home firewall
>
>-----BEGIN GEEK CODE BLOCK-----
>Version: 3.12
>GAT dpu s: a--- C++ UL+++ P++ L+++ E- W++ N+ o+ K w
>O M V- PS+ PE Y+ PGP+++ t++ 5 X R tv b++++ DI++++ D++
>G+ e+ h! r- y
>------END GEEK CODE BLOCK------
|
Copyright © 1999-2021 by the D Language Foundation