Inline imports redivivus
Zach Tollen
zach at mystic.yeah
Sat Mar 12 19:13:33 UTC 2022
On Friday, 11 March 2022 at 13:01:43 UTC, Ali Çehreli wrote:
> Perhaps a second meaning for ..? And is : really necessary?
The character `|` might work too. It looks better if we close it
with the same character.
```d
x = |std.datetime|SysTime;
```
I actually like this one a lot. There is some potential lexical
ambiguity with `|` and `||` as binary operators. However, those
operators are typically separated with whitespace in ordinary
code, so I don't think it will ever be a problem. (The second `|`
in `|std.datetime|SysTime` can be parsed as a part of
`|modname|symbol`, so apart from typos, there's no syntactical
problem.)
The worst you would suffer would be the visual confusion of
something like this:
```d
if (|std.something|condition(sdfd) ||
|some.other.inlinemodule|Test
|| |othermod.imp|mycondition) {
myFlags = |std.something|Flagset | |std.otherthing|Flags;
}
```
This would be the extreme case I think. Syntax highlighting could
help.
I think this is better than `$std.datetime:SysTime`.
More information about the Digitalmars-d
mailing list