On Saturday, 12 March 2022 at 19:13:33 UTC, Zach Tollen wrote:
>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.
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:
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
.
Out of your new alternatives, I like this one the best.
x = :std.datetime:SysTime;
- It is symmetric same as ||
- : is already used in import x:y
- : is not used in expressions unlike | which is quite common.
- We can keep $ for some future codegen features.