-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Macroify: str #10
Comments
So there's another option here: string interpolation using template literals.
It seems like we'd want string interpolation since it more closely maps to Clojure's str? |
I wrote some code to see the differences between the two options: https://gist.github.com/corasaurus-hex/2c03d8abc1c8827b44b59fbdc31a3622 I can't see any difference between them in practice except the ones noted in the paragraph I quoted. So do we want the behavior of string concatenation or string interpolation? I'd vote for interpolation, both for forwards compatibility and it being the least surprising behavior. |
@corasaurus-hex String interpolation is a different issue: this issue is just about generating more efficient code for |
The generated code for (str foo bar) can either be "" + foo + bar or it can be `${foo}${bar}` and I had intended to examine which was the better choice. |
I don’t understand why we should emit template code if the user didn’t use
a templates string. My expectation would be that a JS runtime will have to
do less if you keep it like the user wrote it.
On Wed, 17 Aug 2022 at 13:02, Cora Sutton ***@***.***> wrote:
The generated code for (str foo bar) can either be "" + foo + bar or it
can be `${foo}${bar}`
—
Reply to this email directly, view it on GitHub
<#10 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACFSBS2ZPP4B67GR5VETRDVZTBD3ANCNFSM56PDHJBQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
The main reasons, for me:
String interpolation via templates is just a means to an end for me, though, what I really care about is using |
Right. How CLJS compiles
Does that match the |
But then again, we could just handle that in the |
I don't have a strong preference. My hunch is that my usage of So instead of doing something like (str "Hello, " name "!") I would do #i "Hello, ${name}!" The only time I really need str then is for the |
Agreed |
Yes, |
str
should emit"" + ...
code.I think we still need the core
str
function when the common(apply str ,,,)
is usedThe text was updated successfully, but these errors were encountered: