http://jsfiddle.net/ondras/hYfN3/
https://news.ycombinator.com/item?id=6725387
You can compare it to the readable 67 lines of code in red-lang
http://jsfiddle.net/ondras/hYfN3/
https://news.ycombinator.com/item?id=6725387
You can compare it to the readable 67 lines of code in red-lang
For the "no library", well, you have tons of libraries included in a ~100MB runtime (browser) required to run and render that demo, while Red's one runs on the OS directly (our runtime is 0.6MB uncompressed and entirely written in Red, not a single 3rd-party library). ;-)
That said, that JS demo code is very nice, and its slickness impressive.
[1] https://gist.github.com/dockimbel/b0a413342dc39568696207412a...
What I do see is that the JavaScript does all of this much more cleanly and intelligibly, and has an honest line count.
Incidentally, I also think that cleanly separating presentation from logic is an advantage of the JS / CSS divide, even is JavaScript if far from perfect and CSS is actively horrible.
https://gist.github.com/greggirwin/8d0b1c02ccdbd5520d9c77d49...
The reactive logic is all lifted from the original. Around line 40 you can see where styles are defined inline. Originally I had them just defining visual aspects, but then moved the actors into the cell style as well.
With native widgets, you don't get complete control, and they won't match across platforms. Rebol had its own GUI system, and I wouldn't be surprised to see something similar done by a clever Red...we don't have a name for folks who write Red yet. Racket got the best name, with Racketeers.
Folks who use Red could be referred to as communists ;-) If it takes off, you'll be Big Red.
More VID demos and the type of FRP in RED would be more enticing to me. But truth be told, I stumbled upon Red when looking at short programs translating text to morse code. The Red example (from Rebol actually) was very short, yet easy to read. I program in J, so I know what short, and unreadable means to others; I personally like J.
I realize browsers are ubiquitous, so in essence you just need to count the size of browser, JS engine and code. What would be the bare minimum JS setup to provide core libs, GUI, and other helper libs and a way to run it/distribute it sans relying on pre-installed browsers. Would that be Chromium or Electron? Can you choose the best engine with them, or are they attached to the browser or minimal browser?
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.