Last active
December 9, 2015 04:48
-
-
Save skids/97378d26a684591f1b89 to your computer and use it in GitHub Desktop.
investigation of a possible quasi injection character/texas combo
This file contains 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
A consideration of ‹ and › as quasi injection delimiters, or part thereof. | |
The compose-key (and thus texas mappings) are .< and .> | |
Advantage #0: easy to type | |
Disadvantage #1: texas not really symmetrical | |
Advantage #2: .> is not syntax for anything, I think (?) | |
Disadvantage #3: .< is syntax for $_< | |
Disadvantage #4: visual confusion with < and > | |
Advantage #5: Plenty precedent for angle quotes not being merely quotes | |
Were we to be able to paper over disadvantage #3, texas would look like: | |
quasi { say ‹$message› }; # maybe a bit understated | |
quasi { say .<$message.> }; # a bit icky | |
# Texas usage might look less jarring if voluntarily used heredocish style | |
quasi { say .< | |
$message | |
.> | |
}; | |
However "papering over" #3 would introduce less inconsistency if | |
we did one of two things: | |
A) flip them around, so .< only needs special treatment inside the | |
quasi substitution. You could probably convince yourself this makes | |
some sort of sense given what quasis are doing. | |
quasi { say ›$message‹ }; | |
quasi { say .>$message.< }; | |
quasi { say .> | |
$message | |
.< | |
}; | |
B) double them, which is less easy to type, and still leaves .<.< as a | |
special case rule, though one unlikely to be stumbled upon. | |
quasi { say ‹‹$message›› }; # ‹‹ versus « is not too awful | |
quasi { say .<.<$message.>.> }; | |
quasi { say .<.< | |
$message | |
.>.> | |
}; | |
Playing with choice A a bit: | |
Loosen things a bit so both .< and <. are accepted as a texas version | |
even though compose-key < . does nothing in default setups. | |
quasi { say ›$message‹ }; | |
quasi { say .>$message<. }; | |
This does open some opportunity for problems inside expressions using | |
inequalities, but again, given what {{{}}} is used for, slanging things | |
up a bit inside of it may be just fine. | |
Perhaps the ugliest consequence of that would be: | |
quasi { say .>$message<..method }; | |
Other potential for ugly is if macros will be working inside the | |
regex braid with extensible metasyntax. | |
The second thing is, what if we did something instead of "quasi {"? | |
quasi‹ say ›$message‹ ›; | |
quasi.< say .>$message<. .>; | |
Appendix: | |
What error messages would compete with "› used outside of a quasi"? | |
$ perl6 -e 'my $o; say $o.>' | |
===SORRY!=== Error while compiling -e | |
Unsupported use of . to concatenate strings; in Perl 6 please use ~ | |
$ perl6 -e '+.>' | |
===SORRY!=== Error while compiling -e | |
Prefix + requires an argument, but no valid term found | |
Concluson: not perfect, but serviceable, and there may not be anything | |
better. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment