[Issue 14682] [REG2.037] Incorrect interpretation of ~ []
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Jun 11 02:26:34 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14682
--- Comment #5 from Vladimir Panteleev <thecybershadow at gmail.com> ---
I think it should be fixed, because if you want to append [""], you can do so
explicitly, but if you want to append an empty array, there is no convenient
syntax for it.
I ran into it with the following code:
run([make,
"-f", makeFileName,
"all", "kindle", "pdf", "verbatim",
"LATEST=" ~ latest,
] ~ (config.noDateTime ? ["NODATETIME=nodatetime.ddoc"] : []) ~ [
], sourceDir);
Here I wanted to make an array element conditionally present, so I used:
] ~ (cond ? [elem] : []) ~ [
inside an array literal.
The problem is that this line's meaning changes on whether it is the last line
in the array literal or not.
--
More information about the Digitalmars-d-bugs
mailing list