ayecue / greybel-vs

VSCode extension for GreyScript.
https://marketplace.visualstudio.com/items?itemName=ayecue.greybel-vs
MIT License
16 stars 7 forks source link

Interpreter hangs after calling `launch` in a loop that should be impossible to get stuck in #112

Closed Olipro closed 1 year ago

Olipro commented 1 year ago

After doing an scp and calling `launch, the interpreter gets stuck in a very weird place:

image

It keeps going in this loop infinitely, but never actually executes task, stepping line by line doesn't result in us entering task. Printing self._tasks shows [FUNCTION()]

It should just be executing the task, since the way I use get_custom_object is pushing functions across the boundary.

Perhaps even more strangely, to even reach this function, it has to go through the arg parser in main but the breakpoint I have there is never hit. Very bizarre.

Only guess I have for this one is that passing funcRefs across the boundary upsets the interpreter state in some way.

ayecue commented 1 year ago

Hey thanks for reporting,

In the example you shared it will not actually pull anything from task. Here an example which can also be tested in MiniScript.

test = [1,2,3]

while test.len > 0
    task = @test.pull
    task
end while

Since you you use the addressOf operator you do not actually execute the pull and even after when you call task it will not have the context of test anymore. Therefore it won't do anything.

Perhaps even more strangely, to even reach this function, it has to go through the arg parser in main but the breakpoint I have there is never hit. Very bizarre.

Could you share an example for this case please? I mean the part with not hitting the breakpoint?

Olipro commented 1 year ago

This was my fault, I'm obtaining the address of pull which of course is not what it should be doing.

Sorry for wasting your time on this one. Closing.