4 ms·
Shameless plug: I wrote a Tcl/Tk spreadsheet inspired by that JavaScript one that others have since trimmed down to 29 lines: https://tcl.wiki/41294 https://tcl
by networked 10y ago
Shameless plug: I wrote a Tcl/Tk spreadsheet inspired by that JavaScript one that others have since trimmed down to 29 lines: https://tcl.wiki/41294 https://tcl.wiki/41294. (HN discussion of the initial version: https://news.ycombinator.com/item?id=9275268 https://news.ycombinator.com/item?id=9275268. Note the K spreadsheet in the comments.)
I am rather a fan of both Tcl's and Rebol's GUI DSL.
Edit: I'll explain how the Tcl/Tk spreadsheet works. I am not sure I understood Red's reactive framework quite enough to compare and contrast the two implementations correctly, so if you do understand it, I would love to read your comparison.
The spreadsheet cells are ::ttk::entry widgets comparable to <input type="text"> that are created in a loop and laid out using the built-in [grid] geometry manager. When a cell is created its value is bound to a variable like "A2" by two-way data binding. We then add a "trace" to that variable so that when it is read the command [recalc] runs to update its value based on the formula for the cell before the read completes. This triggers update cascades that resolve chains of dependencies between the cells' formulas. The formulas are plain Tcl expressions mangled by a regexp to allow you to reference the values of variables like "A2" without the "$" prefex.