i love svelte to death but sometimes the sticking to vanilla js approach1 sometimes leads to constructs like $:$store = value2 lol
-
the new syntax they introduce is overwriting vanilla js behavior, so all svelte files are, while being nonsensical sometimes, valid html containing valid js
-
if you're curious:
$:3 means "this statement is reactive", and$variable = valueis the equivalent of writing to the destination of a pointer, but with a store instead of a pointer. the $ is like a deref. so$:$means "reactively dereference a store". -
[identifier] : [expression]is valid syntax: it is a label4 named$5! -
see MDN / Web / JS / Reference / Statements / label and Svelte / Reactivity / Declarations
-
yes, the naming is not the best. but to be fair they really do not have a lot of room there, if they just use valid JS syntax1,6 they have to stick with identifiers being
/[a-zA-Z$_][a-zA-Z0-9$_]*, and_is already used a lot so they cant really take that -
recursive & self-referencing footnotes are fun
the footnote to content ratio of this post makes it feel like a poem
.png)
