-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interpolation bitter desugaring #153
base: master
Are you sure you want to change the base?
Conversation
The syntactic expansion of string interpolation can lead to awkward errors.
Thanks for submitting, @som-snytt! This one is clever, but relies on the unlikely (?) declaration of |
You say unlikely, I say it happened to me. I needed the first commit changing the name before I could do the second: https://github.com/scala/scala/pull/6806/commits People asked a couple of times recently about how it works, and then it mattered to me in an unexpected way. I think the one-liner is pretty good. So good, I couldn't think how to reduce the suggested answers to only four. Another possibility would be to play it straight and show
That's my actual second commit in the PR. Kind of boring, though, in that it gives itself away. More broadly, I think in Scala |
Thanks for the details - my schedule is a bit of a mess at the moment, but will hopefully get around to looking at this over the weekend or next week... |
No rush. I know it appears I have too much time on my hands. I wonder if "Strung out" would be a better title... |
Trying to figure out a version of this that could actually compile without introducing too many obvious crutches. No great options so far, because |
Modulo that the exercise isn't fun anymore (like our hike on hottest day of the year and possibly ever), but the doc says to add a method to StringContext that is the name of my interpolator:
|
Ha! How about this? "Raw is good for you, or so?" ;-)
Slight wrinkle is that A Matter of Context also uses Windows file paths and string interpolation, so it would be nice to find a different "natural" use for |
I actually like the last one, especially since now it says:
No, actually I didn't mean that. |
grin @som-snytt To the previous comment, is there another "natural" use of |
People do say "in the raw" as a synonym for "au naturel". |
The syntactic expansion of string interpolation
can lead to awkward errors.