Thread overview | |||||
---|---|---|---|---|---|
|
April 29, 2007 [Issue 1202] New: Dollar inside array literal inside index brackets is valid. | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=1202 Summary: Dollar inside array literal inside index brackets is valid. Product: D Version: 1.014 Platform: PC OS/Version: Linux Status: NEW Severity: trivial Priority: P4 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: aziz.kerim@gmail.com // writefln([1,2,$]); // '$' is valid only inside [] of index or slice writefln([1,2,3][0 .. [$][0]]); // [1,2,3] writefln([1,2,3][0 .. [0,$][1]]); // [1,2,3] writefln([1,2,3][0 .. [0,1,$][$-1]]); // [1,2,3] writefln([1,2,3][0 .. [0,1,$][$-$]]); // [] writefln([1,2,3][0 .. [$][$-$]]); // [1,2,3] writefln([1,2,3][0 .. $*[$][0]/$]); // [1,2,3] writefln([1,2,3][0 .. [$,[$][0]][0..$][0]]); // [1,2,3] -- |
April 30, 2007 Re: [Issue 1202] New: Dollar inside array literal inside index brackets is valid. | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | d-bugmail@puremagic.com wrote: > http://d.puremagic.com/issues/show_bug.cgi?id=1202 > > Summary: Dollar inside array literal inside index brackets is > valid. > Product: D > Version: 1.014 > Platform: PC > OS/Version: Linux > Status: NEW > Severity: trivial > Priority: P4 > Component: DMD > AssignedTo: bugzilla@digitalmars.com > ReportedBy: aziz.kerim@gmail.com > > > // writefln([1,2,$]); // '$' is valid only inside [] of index or slice > writefln([1,2,3][0 .. [$][0]]); // [1,2,3] > writefln([1,2,3][0 .. [0,$][1]]); // [1,2,3] > writefln([1,2,3][0 .. [0,1,$][$-1]]); // [1,2,3] > writefln([1,2,3][0 .. [0,1,$][$-$]]); // [] > writefln([1,2,3][0 .. [$][$-$]]); // [1,2,3] > writefln([1,2,3][0 .. $*[$][0]/$]); // [1,2,3] > writefln([1,2,3][0 .. [$,[$][0]][0..$][0]]); // [1,2,3] ZOMG! That's awesome! I vote we keep this if only to confuse the hell out of people with it! :) -- Daniel -- int getRandomNumber() { return 4; // chosen by fair dice roll. // guaranteed to be random. } http://xkcd.com/ v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/ |
July 01, 2007 [Issue 1202] Dollar inside array literal inside index brackets is valid. | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1202 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID ------- Comment #1 from bugzilla@digitalmars.com 2007-06-30 19:53 ------- It's valid because it is inside the [] of a slice for the [1,2,3]. -- |
Copyright © 1999-2021 by the D Language Foundation