Postfix type notation - readability and parsing?
Simen Kjærås
simen.kjaras at gmail.com
Mon Mar 11 08:13:04 UTC 2019
On Saturday, 9 March 2019 at 20:50:37 UTC, Paul Backus wrote:
> The only issue with using __LINE__ is that it requires gensym
> to be evaluated in the same scope as the one the variable is
> being declared in.
There are other issues:
string gensym(size_t id = __LINE__) {
return format("_gensym_%d", id);
}
static assert(gensym() == gensym()); // We don't want this to
pass.
unittest {
string[2] s;
static foreach (i; 0..2) {
s[i] = gensym;
}
assert(s[0] == s[1]); // Nor this.
}
The first would be fixed by having __COL__ (being the column of
the line on which gensym is being called). However, that does
nothing for the second case.
--
Simen
More information about the Digitalmars-d
mailing list