the inconsistency comes from the fact that this reactivity, triggered from inside a function, is not taken into account to build the dependency graph and ultimately decide in which order to process the statements
The $ label is one technical reason why I would be hesitant to adopt Svelte for larger projects. It's a core part of Svelte that you can't always avoid, and I think the potential for introducing bugs through it is high to start and very high at scale.
The reactivity system in Svelte is really a joy to use, once you get used to it there's no turning back.
But the author did hit one of the ugliest pain points about it. Svelte can NOT correctly infer transitive dependencies when the variable being updated is inside a function. Meaning that the variable itself will be reactive (it will be invalidated every time it's assigned, even inside a function) but Svelte is not using that information to build the dependency graph, and falls back to the order in which the reactive blocks were defined, which may or may not be right.
I still think we could do better, at least explaining the issue and how avoid to fall into it (perhaps some linting warning?)
But I really hope svelte developers start considering this an issue to solve, it's inconsistent (meaning the variable is reactive but that reactivity is not taken into account to order the operation in "topological order" (Hey, I learnt about that from one of Rich's presentations, see https://rethinking-reactivity.surge.sh/#slide=19) and as I said before, in the rare occasions you stumble upon it is not so easy to understand what's going on.
Thanks to everybody's feedback on this one... You encouraged me to write another article, mainly because I felt a little guilty for bashing (pun intented) bash and python ;-)
Hope you like it http://playlatam.wordpress.com/2012/01/13/first-steps-with-s...
sas@ubuntu:~/devel/apps/playdoces/documentation/1.2.4/manual/tmp$ ./status.scala
error: script file does not close its header with !# or ::!#
one error found
you're right jez, I guess I couldn't resist the temptation of a catchy title, just changed it to: First steps with Scala, a functional alternative to bash scripts… I think it's more appropriate: http://playlatam.wordpress.com/2011/12/05/first-steps-with-s...