Revert reservation of ":" within styled regions#30
Merged
Conversation
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.
Member
Author
|
Given a week's gone by with no comment, I'll go ahead with this now 🙂 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #28 (which see).
Will merge shortly if everything appears to be in order.