Nightwatch, on May 18 2008, 01:25 AM, said:
After fighting some more with the editor, I'm not convinced that the robotic editor is that good of a match for Lua. The Robotic editor is fundamentally tied to the concept of a line as bytecode, and Lua doesn't work that way. It's very difficult to do even simple things like commenting out code properly, and the number of bugs related to the robotic editor is bad enough without hacking a clumsy generic line editor into it. Not saying that Exo did a bad job, of course... I think the "Robotic is bytecode and its text representation doesn't really exist" design makes it difficult no matter what you do.
I agree 100%. For years I've been preaching that Robotic can't move forward so long as it's tied to its bytecode like this, and it has really held us back from improving the language. I had planned several times to do two things as an initial push to revising Robotic: make an extension allowing Robots to be stored as source as opposed to bytecode, and writing a highly general macro system for Robotic to allow it to be extended. Unfortunately the plans for the latter got out of hand and I don't really have the focus/interest to work on MZX anymore anyway. Nonetheless, the first part shouldn't be that difficult.
As you mentioned, the port was done really just to give MZX compatability first, with most of the (relatively minor) improvements focusing on improving the editing aspect; the internal representation in particular was left intact. Nevertheless, I don't think hacking the Robotic editor to be a general line editor is as bad as it sounds. The one I wrote already has the ability to use "unverified" lines, you can just go from here and remove the verification/compilation stage at the end (or replace with a Lua one), and store the line buffers sequentially as opposed to the compiled bytecode (and if you didn't know, you can comment/uncomment a line with ctrl + c)
As far as expanding the MZX format and editor in a simple way to support this, I would suggest just using a robot bytecode length of 0. I normally don't like hacks like this, but I'd hate to see the MZX world format changed in such a way that makes it difficult to maintain compatibility. I wouldn't go for version stringing it, there might be useful reasons to have mixed robots, at least at first (like for loading old MZMs)
Then it can go something like this: robot structure has bytecode and source buffers. Upon loading, if length is non-zero, disassembler is used to convert bytecode to source (this should be pretty straightforward), length is set to zero with whatever other header extension stuff placed in. You can either abandon the bytecode or not - I strongly recommend throwing it out because the current bytecode sucks and it'd be good to have something much better. Robot editor loads line buffers with source directly instead of bytecode + disassembly (just have to change this part at the top) and then stores the source (just have to change this part at the bottom). Then upon exiting the The robot interpreter will then see if bytecode exists for a robot as it is run, and if not it will assemble the source code into bytecode. There's no point storing both in the MZX file.
From here it'd be nice to see a new Robotic VM, or maybe if you're so inclined (and you get far enough with the interoperability) you can convert it to Lua, although I'm not sure yet if I'm happy with pushing Lua as the foundational language of MZX.
Nightwatch, on May 18 2008, 01:25 AM, said:
Thoughts?
Sorry, but I think this is a really bad idea. The scroll/sign editor/display code and the help system is probably the worst bit of code left in MZX, in fact, the former even has fatal bugs that haven't been killed (unless they have since I last worked on things). I meant to rewrite it entirely like I did most everything else, I just haven't bothered because really signs and scrolls aren't that important anymore and I don't really mind discouraging the use of the clunky [ boxes (I guess that's not really entirely fair of me though). These editors have just about zero functionality. If you're uneasy with the robotic editor then you should probably write a new one entirely.
You know, you can use external scripts for Robotic too.. :<

Help












