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

String interpolation specification refers to unspecified "concatenation" #7561

Open
peter-ahe-google opened this issue Dec 21, 2012 · 2 comments
Labels
area-specification P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@peter-ahe-google
Copy link
Contributor

String interpolation is defined like this:

"An interpolated string ‘s1${e}s2’ is equivalent to the concatenation of the strings ‘s1’, e.toString() and ‘s2’."

But what does "concatenation" mean. I suggest that it be defined in terms of a library call.

@peter-ahe-google peter-ahe-google added Type-Defect area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). labels Dec 21, 2012
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed triaged labels Feb 29, 2016
@munificent munificent added area-specification and removed area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). labels Dec 16, 2016
@eernstg
Copy link
Member

eernstg commented Feb 6, 2018

No milestone now: This will not block Dart 2.

The clarification may still be needed, and will be considered later.

@eernstg eernstg added this to To do in Dart Language Specification via automation Aug 24, 2018
@srawlins
Copy link
Member

Interestingly, "concatenate" is used in a few places w.r.t Strings:

Adjacent strings are implicitly concatenated to form a single string literal.

Dart also supports the operator + for string concatenation.

However, the use of the concatenation operation is still discouraged for efficiency reasons. Instead, the recommended Dart idiom is to use string interpolation.

It is possible to embed expressions within non-raw string literals, such that these expressions are evaluated, and the resulting objects are converted into strings and concatenated with the enclosing string. This process is known as \Index{string interpolation}.

What's interesting here is that efficiency comment. The "concatenation" found in string interpolation must be different from the "concatenation operation," if it is more efficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-specification P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
Development

No branches or pull requests

6 participants