Devlog: what is a module?
Last updated
Time for devlog #2! Last week's was here.
I've spent a bunch of time refactoring and hardening the code to better reflect the data model of this application.
After using it a bit, I felt that the cells were a bit constrained. They only had a "Value" and a "Display" associated with them—and both were special values. You could only read "Value" and only view the results of the "Display".
What if a cell needed intermediate calculations as part of it?
What if you could read (and write to) other properties of a cell, like its X/Y position?
So I've updated the code (but not the UI) so that these are configurable and accessed in the same manner. And access is
a bit more straightforward. If you have a cell named "color" which has a "$value" and "$x" property, then you can access
those via: color.$value.get()
/ color.$x.set(100)
. And they also a .subscribe()
method on them, which allows
them to be bound directly to JSX: <input type="color" value={color.$value} />
. How handy!
But instead of using my written words to describe how to use it, here's a brief (6min) screen recording showing how to use it (and with me talking about what I'm doing).
I hope this makes things a bit more clear than the last one:
What is a module?
This'll make a bit more sense if you watch that video. But I've been thinking that this collection of "cells" in this tool are a bit like variable declarations in a module.
I'm talking specifically about JavaScript here, but a module is a collection of named variables. Outputs of the module are variables marked for export. Inputs to the module are declarations imported from another module.
And similarly for functions: A function is a collection of named variables. The output of the function is a returned variable. Inputs to the function are its parameters provided by a caller.
I want to see if both functions and modules can be manipulated in this same visual, reactive, dynamic manner!
I want to be able to create a function by creating a "cell" for each function parameter, create intermediate "cell" values that the function needs to do its thing, then create a "return value" cell which calculates the result of the function.
So I think that's where I'm headed next.
Also, I'll hopefully fix some of the (many) bugs that are lurking in there.
Stay tuned for more!