-
-
Notifications
You must be signed in to change notification settings - Fork 723
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 #1473
Comments
Few implementation notes, feel free to correct me @lpil
|
|
I'm assuming this is because the string interpolation is interpreted as a literal? Or do we want arbitrary expressions inside of interpolation? e.g.
|
Yes that's right, any arbitrary expression is to be permitted within |
Closing this because I would like to see how far we get with |
Prior discussion: #1086
Syntax
Here a variable is used with the
${}
interpolation syntax, but any arbitrary Gleam expression is permitted.Erlang output
JavaScript output
Typing
The interpolated expression within the
${}
must be of typeString
. In future we could permit other types, but not for this first version.AST
I suggest that this AST node could be represented like so:
When performing code generation we can check to see if each expression is a string literal or not and have a special case for that in order to get the right output syntax.
The implementor may determine that there is a better representation.
The text was updated successfully, but these errors were encountered: