Re: [WICG/webcomponents] [templates] A declarative JavaScript templating API (Issue #1069)

@sorvell 
> @EisenbergEffect
> 
> > what if we could introduce the idea of lazy evaluation to tagged template literals?
> 
> I've separately thought about this and it seems like a great thing to propose. It's a feature that can easily seem trivial in isolation: how hard is `()=>`? and (minus the obscurity) could you make anything more terse?
> 
> It's specifically when used with an API like this where you might need these arcane characters dozens of times that it becomes really onerous, as indeed even the `$` at the front of values in literals is.

It's not just about character count to me, but also about author intent. `() => ...` could be a computed value, but it also could be just a function that you want to pass. If you default to interpreting it as computed value, then you need to do something like `() => () => ...` to pass a function.

A template system also doesn't know if every binding should be interpreted as a computed signal or not, and so whether to watch it, so without either a manual approach or syntax, the template system has to watch everything.

That's why I think that one of the main benefits of a special is just capturing the user intent that a binding is a signal.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/1069#issuecomment-2302497570
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/1069/2302497570@github.com>

Received on Wednesday, 21 August 2024 16:26:29 UTC