SIP-24: Simplified simple form interpolation

195 views
Skip to first unread message

Som Snytt

unread,
Jul 8, 2014, 4:28:32 PM7/8/14
to scala...@googlegroups.com
Here is a freshening of SIP-24.  It features simplified simple form interpolation: any Scala identifier is OK, and $" is taken for literal quote.

https://github.com/som-snytt/scala.github.com/compare/sip/24

I edited the language and the examples.  In particular, I used the Bob example from SIP-11.  Since "big_bob" makes an appearance in SLS 1.1, I'm pretty sure Bob is significant in some way.

The gist is that arbitrary identifiers are accepted for "simple form" or braceless interpolation, including backquoted identifiers.

The fact that identifiers with dollars must be backquoted is mentioned in the commit message but not yet in the SIP document.

The implementation is at

https://github.com/som-snytt/scala/commit/85316634970e87b925e18160cefbfeef74d728b6

I just noticed it incorrectly excludes s"$_foo".  Off the top of my head, I don't know whether it's better to require s"$`_`foo" or s"$`_foo`"; probably the first.

Also, scanning for ids uses nextChar instead of nextRawChar, which differs in newline handling, but I haven't experimented yet.  I'm just on lunch break (at the home office, watching company videos, for the record.  I just needed a relaxing coding break.)


Kevin Wright

unread,
Jul 8, 2014, 6:16:52 PM7/8/14
to scala...@googlegroups.com
Yay!

Can I now mention that I have an SIP on my resumé?  Perhaps I should look into getting a laptop sticker printed...

Som Snytt

unread,
Jul 11, 2014, 3:07:32 AM7/11/14
to scala...@googlegroups.com
I'd forgotten that interpolator ids had been upgraded already:

https://issues.scala-lang.org/browse/SI-7322

I thought it was less a bug than a gnat, but Adriaan opined on the PR that it was "(less gnatty to me)", as it surely was.  And unsipped!



--
You received this message because you are subscribed to the Google Groups "scala-sips" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-sips+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages