Last week's thread really energized me to continue...
# two-minute-week
k
Last week's thread really energized me to continue working on my prototype postfix language and environment: https://archive.org/details/akkartik-2min-2020-09-27
😎 4
❤️ 1
a
Why the function definition is 2 x *, but when expanded it's x 2 *?
k
My mistake. The left side is just a mock-up. _Edit_: now fixed by https://github.com/akkartik/mu/commit/7258083c6
This morning the suspicion returns that this is a dead end. When I designed expanding function calls I tried to support multiple levels (calls within calls). It doesn't work yet, of course. The cursor doesn't enter call bodies yet. I could make it work, but then what would editing call bodies mean? I could disallow it, but that restriction could also be confusing.. In case it isn't obvious, I'm not a designer. This prototype is taking me out of my comfort zone far more than all of Mu before. So comments and suggestions most appreciated.
g
i really like this and i hope you keep exploring! one expectation i might have is that when you expand the call stack and put your cursor in it you’re editing the function definition rather than the dynamic call—maybe indicated by something like
2*: x  |2| * //pipes represent cursor
3  |2| *
and then editing the function would ask whether you want to make a new function or edit the old one. that may be way too complicated, though
👍 1
d
Really cool @Kartik Agaram. My hunch would be to try different layouts, for example a horizontal representation of the stack. My idea comes from thinking how would it look with a data type like a string, that the 'values' are longer than 1 character.
k
Indeed. I have some sketches where string literals would turn into little editors with wrapping. But rotating is also worth trying.
a
One idea I got experimenting with structural editors is that you can use pretty-printing algorithms to layout code. Now I don't know how to write a good pretty-printer for a stack-based language, but I hope that you can figure that out. (got the idea from https://molikto.github.io/posts/06-growing-a-structural-editor-02.html)
💡 1
g
killer quote from that article putting to words an intuition i’ve been grappling with
💡 1
c
I would make it so that the expanded function definition is rendered differently, to make it obvious it is read only. The there are two ways to edit; 1. Jump to function definition which opens the function definition in the left pane, where you edit it (with variable names). Your edits are immediately reflected/duplicated in the expanded definition, this stack with real values. Because your cursor is duplicated, the user may well be looking at the right pane, but it should be obvious this is not what's "really" happening. 2. You can "dump" the function definition into your main program. The definition shifts up to be in line with normal code. Edits do not affect the actual function definition. (edit to point out this is a variation on Garth's idea)
❤️ 3
j
Only tangentially related to the matter at hand, but I thought @Kartik Agaram might enjoy this minimal bootstrap FORTH that fits in a boot sector: https://github.com/cesarblum/sectorforth
k
Indeed! It's 16-bit so sidesteps the same problems as Skip. Please keep an eye out for a 32-bit project, everyone!