New SIP-24, backticks in string interpolation

已查看 152 次
跳至第一个未读帖子

Kevin Wright

未读,
2014年2月8日 17:35:302014/2/8
收件人 scala-internals

Pull request here:

Looking at the queue though, it seems as though pull requests aren't getting much love.

Would someone suitably acquainted with the current setup be able to glance over the current docs for SIP submission and make sure that they aren't missing any other steps I needed?

Denys Shabalin

未读,
2014年2月9日 06:24:472014/2/9
收件人 scala-i...@googlegroups.com


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

Kevin Wright

未读,
2014年2月9日 08:42:402014/2/9
收件人 scala-i...@googlegroups.com

Jason Zaugg

未读,
2014年2月17日 08:19:472014/2/17
收件人 scala-i...@googlegroups.com
On Sat, Feb 8, 2014 at 11:35 PM, Kevin Wright <kev.lee...@gmail.com> wrote:
I don't see a problem with s"$`a b c`". I'm against the extended proposal, though.

There is another proposal floating around to fill a hole in interpolation: to add a new escape: $"


Kevin, would you like to incorporate that into the SIP so both could be discussed together?

-jason

Kevin Wright

未读,
2014年2月17日 09:03:152014/2/17
收件人 scala-internals
Sure, I can add that :)

I also have another enhanced variant that I've been mulling over,to use guillemets (french/angle quotes) for interpolation.  Some of the examples previously seen would then become:

s"implicit def hlistTupler«arity»[«A..N»] : Aux[«A::N», «(A..N)»] = ..."
s"I am «qual»body"
val `"` = '"'
s"a=«"»$a«"»"
In this form, I'd only allow string-literal identifiers and not full expressions - so as to avoid ambiguity in parsing.

The precedent has already been set for using unicode characters with arrows for lambdas and in comprehensions, so this doesn't seem *too* shocking to me.  There would still, potentially, be a some already featuring angle-quotes in interpolated strings. So even this proposal isn't entirely risk-free.


--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-interna...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.



--
Kevin Wright
mail: kevin....@scalatechnology.com
gtalk / msn : kev.lee...@gmail.com
vibe / skype: kev.lee.wright
steam: kev_lee_wright

"My point today is that, if we wish to count lines of code, we should not regard them as "lines produced" but as "lines spent": the current conventional wisdom is so foolish as to book that count on the wrong side of the ledger" ~ Dijkstra

Jason Zaugg

未读,
2014年2月17日 09:15:402014/2/17
收件人 scala-i...@googlegroups.com
On Mon, Feb 17, 2014 at 3:03 PM, Kevin Wright <kev.lee...@gmail.com> wrote:
Sure, I can add that :)

I also have another enhanced variant that I've been mulling over,to use guillemets (french/angle quotes) for interpolation.  Some of the examples previously seen would then become:


s"implicit def hlistTupler«arity»[«A..N»] : Aux[«A::N», «(A..N)»] = ..."
s"I am «qual»body"

val `"` = '"'
s"a=«"»$a«"»"
In this form, I'd only allow string-literal identifiers and not full expressions - so as to avoid ambiguity in parsing.

The precedent has already been set for using unicode characters with arrows for lambdas and in comprehensions, so this doesn't seem *too* shocking to me.  There would still, potentially, be a some already featuring angle-quotes in interpolated strings. So even this proposal isn't entirely risk-free.

In my opinion, having a $ before every interpolation is something we should keep. Its consistent with string interpolation from other languages, as is use of ${} when whitespace isn't enough to demarcate the end of the identifier.

-jason

virtualeyes

未读,
2014年2月17日 14:51:572014/2/17
收件人 scala-i...@googlegroups.com
Interesting, I don't have a burning need for backticks, but I'll agree that they are slightly more readable.

However, s"$foo" and s"${foo}" won't surprise new comers (of course s"$foo.bar" will ;-))
回复全部
回复作者
转发
0 个新帖子