Beni Cherniavsky-Paskin
04/29/2025, 12:08 PMBeni Cherniavsky-Paskin
05/24/2025, 10:00 PM4.1 State Should Be Relatable, Visible and Editable
... Conventional imperative languages such as C, Java, and C#, also separate state into local variables on the stack and objects living on the heap. This separation can be confusing and lead to misunderstandings.
... Even systems designed for beginners like Scratch tend to scatter state by maintaining variables, position for individual objects, or drawings on screen. We believe that a scattered state leads to additional cognitive overhead and instead intend to maintain a single central state. Algot avoids variables as separate entities from other state.โข Instead of local variables, one is supposed to insert a new (disconnected) node to the global graph, mutate/grow connections, and remove it from the graph when done. (you do bind a local name to it, but that's immutable โ the state lives in node's content and connections, and cosmetic โ you don't really reference by name, you click it) โข They didn't 100% banish scattered stack state: Procedure parameters get bound (by ref.) to concrete nodes given as arguments โ so there are hidden activation records somewhere. โข The recursive examples given do materialize in global state parts of what'd usually be implicit in stack ๐. E.g. fibonacci works with explicit linked list of prior results. Is this purely stylistic? No, it's encouraged by IIUC not having return values! [interesting heresy #3! ๐ฎ] Procedures can "return" results by mutating the global state graph (possibly via output parameter pointing there). Even builtins like "add" take assembly-like src1, src2, dest. [All in all, my first instinct was to protest, but the goals are interesting and the choices nicely provocative ๐ค]
Sverrir Thorgeirsson
06/21/2025, 9:10 PMThey aspire to improve this in future by letting you pick example inputs and see actual values.I added this a couple of years ago ๐ Algot now supports example-based programming. You can test a recent version of the system here (with a tutorial): http://otp.algot.org. Also, here's a really cool extension of the system for teaching software testing that my student Max Barth implemented last year: https://testvision.algot.org/ Here's a talk I gave on Algot and related topics last year: