lapisnev

Don't squeeze me, I fart

Things that make you go 🤌. Weird computer stuff. Artist and general creative type. Occasionally funny. Gentoo on main. I play rhythm games!

Inkscape Monofur font Cohost PLUS!

You can post SVG files like photos on this website! Spread the word!


lexi
@lexi

i love svelte to death but sometimes the sticking to vanilla js approach1 sometimes leads to constructs like $:$store = value2 lol


  1. the new syntax they introduce is overwriting vanilla js behavior, so all svelte files are, while being nonsensical sometimes, valid html containing valid js

  2. if you're curious: $:3 means "this statement is reactive", and $variable = value is 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".

  3. [identifier] : [expression] is valid syntax: it is a label4 named $5!

  4. see MDN / Web / JS / Reference / Statements / label and Svelte / Reactivity / Declarations

  5. 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

  6. recursive & self-referencing footnotes are fun


guy-with-dog
@guy-with-dog

the footnote to content ratio of this post makes it feel like a poem


You must log in to comment.

in reply to @lexi's post: