Live data from Hacker News

Tangle is a JavaScript library for creating reactive documents.

worrydream.com

51–60 of 63 posts

Re: Tangle is a JavaScript library for creating reactive documents.

#52
This is one of the ideas I'm working on integrating into my toy data/programming language, Fern. https://github.com/andrewf/fern. It's not apparent from the README, but if you modify a Fern structure in memory, all dependent values will (should) be updated, even with name references pointing back up the hierarchy of data structures. These are mostly lists and maps (which define names for subsidiary structures), which can be generated by constructs like conditionals, functions, and (someday) loops.

Besides the ideas I listed, I see it being used in scenarios where you have formulas based on a few inputs, and want to see what the output looks like when you mess with stuff, like physical dimensions in a design or financial stuff.

It's nice to have a real term for this sort of thing in "reactive document" or "reactive programming" or what have you. Not so nice to realize my idea isn't unique and brilliant. :)

Re: Tangle is a JavaScript library for creating reactive documents.

#53

This is one of the ideas I'm working on integrating into my toy data/programming language, Fern. https://github.com/andrewf/fern . It's not apparent from the README, but if you modify a Fern structure in memory, all dependent values will (should) be updated, even with name references pointing back up the hierarchy of data structures. These are mostly lists and maps (which define names for subsidiary structures), whic…

How does this work? Is it simply a shit ton of Observers?

Re: Tangle is a JavaScript library for creating reactive documents.

#54
post #53

This is one of the ideas I'm working on integrating into my toy data/programming language, Fern. https://github.com/andrewf/fern . It's not apparent from the README, but if you modify a Fern structure in memory, all dependent values will (should) be updated, even with name references pointing back up the hierarchy of data structures. These are mostly lists and maps (which define names for subsidiary structures), whic…

How does this work? Is it simply a shit ton of Observers?

Basically, a dirty flag that is checked every time you try to read a value. More specifically, each object has a self.value attribute that serves as a cache of the object's content. When it is notified that something has changed, it deletes the value. When you access it, it recomputes itself from scratch, taking advantage of caches of subobjects where possible.

You can see most of the logic in fern.ast.node.Node. self.refresh_impl is supposed to set self.value in a way appropriate to the subclass, and the Node functions handle the rest.

This is actually a pain to debug, especially with lots of nested scopes, but it seems to me like the evaluation should be lazy, rather than changing one object potentially re-computing the entire tree when you only cared about one part. You can call .refresh() on it manually if you need to get the computation out of the way.

Re: Tangle is a JavaScript library for creating reactive documents.

#57
If you like explanations like these, maybe you'll like the live explanation of the Burrows-Wheeler Transform that I wrote a few years back: http://canonical.org/~kragen/sw/bwt.html

I keep meaning to put it on the back of a better library so that it doesn't hang up the page if you type a too-long string.

Re: Tangle is a JavaScript library for creating reactive documents.

#58

This is one of the ideas I'm working on integrating into my toy data/programming language, Fern. https://github.com/andrewf/fern . It's not apparent from the README, but if you modify a Fern structure in memory, all dependent values will (should) be updated, even with name references pointing back up the hierarchy of data structures. These are mostly lists and maps (which define names for subsidiary structures), whic…

It sounds like Cells or the Trellis.

Re: Tangle is a JavaScript library for creating reactive documents.

#59

This is one of the ideas I'm working on integrating into my toy data/programming language, Fern. https://github.com/andrewf/fern . It's not apparent from the README, but if you modify a Fern structure in memory, all dependent values will (should) be updated, even with name references pointing back up the hierarchy of data structures. These are mostly lists and maps (which define names for subsidiary structures), whic…

Sounds a bit like what they in .NET, especially WPF, call DataBinding? I.e a control can display a mirror of a variable/property without much manual intervention.

Re: Tangle is a JavaScript library for creating reactive documents.

#60
post #58

This is one of the ideas I'm working on integrating into my toy data/programming language, Fern. https://github.com/andrewf/fern . It's not apparent from the README, but if you modify a Fern structure in memory, all dependent values will (should) be updated, even with name references pointing back up the hierarchy of data structures. These are mostly lists and maps (which define names for subsidiary structures), whic…

It sounds like Cells or the Trellis.

What "Cells" are you talking about? Trellis looks cool; thanks for the tip.
Post reply on HN