tc39 / proposal-signals

A proposal to add signals to JavaScript.
MIT License
2.87k stars 54 forks source link

Question: `<template>` syntax #200

Closed JosXa closed 2 weeks ago

JosXa commented 2 weeks ago

Quick question as I'm out of the loop here. What's the deal with the <template> syntax below execution result comments that gets thrown around?

image

Is there some special tooling that creates them or is that simply the way we standardized on to represent JSX and other DOM framework variants in pseudocode?

EisenbergEffect commented 2 weeks ago

@JosXa I believe that's specific to one library in particular. But I think these examples are mostly used to provide some way of showing how things might integrate with the DOM. Syntax/framework may vary.

NullVoxPopuli commented 2 weeks ago

adding on to what @EisenbergEffect said, in signal-utils ( https://github.com/proposal-signals/signal-utils ), I wanted to use a made up syntax -- I didn't want to use JSX, because it has assumptions that are implementation dependent -- and that could lead to subtle miscommunications.

I didn't want to exactly use any framework (that I know of)'s syntax to try to not show favoritism (in reality this is a Svelte and Ember hybrid, which are, in turn, influenced by a few other things).

The goals of this psuedo code is to demonstrate that things are "mostly JS" (as to not be too distracting to foreign syntax), but a rendering system brings you through the final mile, implying that the framework handles effects, etc -- the purpose of all is to mainly look more like something you might encounter in the wild, rather than lower-level things (like rendering effects as in the proposal's README's examples)

execution result comments that gets thrown around?

I added these as convention because READMEs can't render anything reactive :sweat_smile:


Hope this helps! if you (or anyone) has more questions, I'm happy to answer. :tada:

JosXa commented 2 weeks ago

Great, thank you for thorough explanation! :)