Skip to content
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

[feature] extend string interpolation syntax to add 'json' interpolator #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jiahut
Copy link

@jiahut jiahut commented Sep 29, 2014

It's an easy-to-use library with handing json.
I just do my best to add a feature to make It better.

def json(args: Any*): JValue = {
val strings = sc.parts.iterator
val expressions = args.iterator
var buf = new StringBuffer(strings.next)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be val buf: StringBuilder

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could leave it out?

@wspringer
Copy link
Owner

Thanks jiahut! I have been considering if I wanted to support this type of String interpolation, but I'm not entirely convinced just yet. First of all, I think you will find that for almost all cases, the builders actually offer a way more compact notation, with less boilerplate.

Perhaps if there is a list of examples where this clearly shows a benefit over the builders, I might be willing to pull it in. It's a cool feature, but adding cool features is not an objective. It needs to be useful as well. And I'd argue completeness is not achieved if there's no longer anything to add, but if there's no longer anything left to remove. ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants