[Issue 8008] static array literal syntax request: auto x=[1,2,3]S;
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Apr 30 14:18:11 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8008
bearophile_hugs at eml.cc changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bearophile_hugs at eml.cc
--- Comment #1 from bearophile_hugs at eml.cc 2012-04-30 14:19:21 PDT ---
Aesthetically-wise this new literal syntax is not so good, but it solves a
problem, I think it doesn't introduce problems, and it's effective, so it's an
interesting idea:
auto a1 = [1, 2, 3]s;
auto a2 = [1, 2, 3]S;
auto s1 = "abc"s;
auto a3 = ["abc"ds, "def"ds]s; // dchar[3][2] ?
A problem is that "static array" is not a correct term in D, because here foo
is a static array but it's not what you are writing about:
void main() {
static foo = [1, 2];
}
So I generally call them fixed-sized arrays. So an alternative is to use a
different letter to denote them (I don't think they get confused with floats):
auto a1 = [1, 2, 3]f;
auto a2 = [1, 2, 3]f;
auto s1 = "abc"f;
auto a3 = ["abc"f, "def"f]f;
The [$] was shown in Issue 481 and elsewhere.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list