You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In 5dd8b9e we reserved the use of ":" in styled regions in
anticipation of the potential use of a style and format construction
"{style:content:format}" inspired by Python's f-strings.
It has since become apparent that this causes more headaches than
anticipated in Julia. The primary reason for this is the different
syntactic meaning that ":" has in Julia compared to Python. While in
Python ":" serves as a block terminator (used after: if, for, while,
def, etc.), in Julia ":" can appear /within/ expressions (namely with
ranges and indexing), for example:
1:2:9
m[1, :]
:(1 + 2)
This means that when formatting an expression, copy-paste is now subtly
error-prone as not just quotes but colons will need to be escaped.
This adds to the minor, but present, annoyance of having to escape ":"
in "{style:content}" constructions, and in my mind tips the scales
towards the prospective "{style:content:fmt}" syntax no longer being
worth it.
A more promising alternative is to go with something like "${fmt:expr}".
By both this and "{style:content}" having a single delimiting colon, we
can simply read everything until the paired closing curly parentheses at
the end of the form as expr/content. The use of "$" in "${fmt:expr}" is
also evocative of Julia's $-interpolation syntax, which is appropriate
given that expr would be evaluated.
While a formating syntax, let alone system, is not decided on at this
stage, I think we can safely un-reserve the colon.
0 commit comments