Replies: 12 comments 10 replies
-
Nitpicking: |
Beta Was this translation helpful? Give feedback.
-
Yes,
|
Beta Was this translation helpful? Give feedback.
-
Or |
Beta Was this translation helpful? Give feedback.
-
Outside of the reader tag we use, how ought we to handle custom tag functions? Something that would expand to html`<div style="color: red;">hello ${user}!</div>` |
Beta Was this translation helpful? Give feedback.
-
perhaps we could allow passing in a list, like |
Beta Was this translation helpful? Give feedback.
-
maybe #` ? Some way to indicate that these are backticks? |
Beta Was this translation helpful? Give feedback.
-
oh dang that's not bad @lilactown, I like it |
Beta Was this translation helpful? Give feedback.
-
how does that generalize to bare template strings, though? |
Beta Was this translation helpful? Give feedback.
-
i'm a bit ignorant of how the reader works is but i think we could have it support both bare strings as well as lists with a tag function #tmpl "Hello, ${user}!"
#tmpl (html "<div style=\"color: red;\">hello ${user}!</div>") I'm using |
Beta Was this translation helpful? Give feedback.
-
Thinking out loud, I'm worried about how we'll handle complex cases than just interpolating a variable. For instance, how should we handle expressions? #tmpl "Hello, ${(:name user)}!" Perhaps we should lean into the tag accepting a collection, and instead of writing the #tmpl ("Hello, " user-name "!")
#tmpl ("Hello, " (:name user) "!")
#tmpl (html "<div style=\"color: red;\">Hello, " user-name "!</div>") |
Beta Was this translation helpful? Give feedback.
-
Hmm, this isn't any better to me than just using We could support |
Beta Was this translation helpful? Give feedback.
-
@borkdude how should we handle arbitrary expressions inside of the template string, like I was talking about above? |
Beta Was this translation helpful? Give feedback.
-
@corasaurus-hex String interpolation is a different issue: this issue is just about generating more efficient code for
(str foo bar)
=>cherry/str(foo,bar)
vsfoo + bar
.I think string interpolation should also be a built-in feature that compiles directly to JS string interpolation. We can support this using a reader template
#i "foo ${name}"
. I'll make a different issue for that.Originally posted by @borkdude in #10 (comment)
Beta Was this translation helpful? Give feedback.
All reactions