Closed cardillan closed 1 month ago
your suggestion makes no sense, stop is literally just an unconditional jump to the start
That is the end
instruction.
stop
just stops the processor, preserving all variables, including the @counter
, for inspection. There's no way to resume the processor from this state except by modifying the code.
Rather late, but won't it make more sense to implement it like a conditional breakpoint, rather than an instruction (i.e. small sidebar to set breakpoints, similar to how vs code does it), set a visual indicator, and potentially dump all variables into a static log, to be reviewed later? But I guess that would be a lot of effort for a rather unnecessary feature
Breakpoints would be great for interactive debugging. There are actually one or two debugging mods that have something similar. I tried one just the other day, some debugging was possible, but single-stepping through the code always executed a bunch of instructions at once, which was annoying.
I envision the stop
instruction for handling unexpected conditions in a program (e.g. an array index out of bounds) by the compiler. It is doable with the current one, but you need at least two instructions (a jump around a stop) to not lose the @counter
context. Three, if you want to embed some explanation or error message in a print instruction above/below the stop.
Might make more sense to keep the existing stop
block as it is, and make an exception
block that's either blocking or non blocking based on a toggle, and can show details, maybe with an optional additional jump to some exception handling code (ideally preserving @counter
). Just makes a bit more sense for semantics, and makes it a bit simpler.
The stop
instruction should probably stay, because there are a few cases where it's useful (e.g. killswitch), and for backwards compatibility.
Make the
stop
instruction conditional
Just put the jump instruction right before the stop
Just put the jump instruction right before the stop
That's possible, of course. I was hoping there would be a way to replace this sequence:
jump label1 lessThanEq index 10
print "Index out of bounds accessing ARRAY"
stop
label1:
...
with a single instruction stop greaterThan index 10 "Index out of bounds accessing ARRAY"
, because it would be three times cheaper for a compiler to generate such checks, and easily readable even in the mlog code.
I'd consider the visual indication of a stopped processor the most useful, though. It would make spotting buggy code much easier.
Very late, but should be possible to make it have a yellow status indicator if stopped (because it's working and paused, but it's not not working (like a red status indicator)), and it should only appear if status indicators are enabled
I wouldn't even mind the red diamond. Whether a hyperprocessor is stopped due to not having cryofluid, or due to encountering a stop instruction, it needs to be fixed.
I'm not sure the status indicators are even implemented for 1x1 blocks, though. I don't recall ever seeing one. And the disabled indicator is different for 1x1 blocks and bigger blocks.
Maybe some visual indication could easily be added by a mod. I'll try to investigate it.
This suggestion is now stale, and will be automatically closed.
Describe the content or mechanics you are proposing.
I propose the following enhancements to the
stop
instructionstop
instruction conditional:jump
, except there would be no target. When the condition is met, the instruction stops, otherwise execution continues.stop
instruction might contain additional parameter (say,reason
). When stopped by the instruction, the processor's tag would get set to this value.stop
instructions would need to get converted tostop always
for backwards compatibility.Describe how you think this content will improve the game. If you're proposing new content, mention how it may add more gameplay options or how it will fill a new niche.
Before making this issue, check the boxes below to confirm that you have acknowledged them.