enso icon indicating copy to clipboard operation
enso copied to clipboard

Removing last node from main graph makes execution error

Open farmaazon opened this issue 11 months ago • 5 comments

As in description: the error appears:

image

And then nothing can be done in the graph.

farmaazon avatar Feb 26 '24 08:02 farmaazon

Not reproducible on c2842df8d83139702f9ba712452f0ea84f98524e

farmaazon avatar Feb 29 '24 13:02 farmaazon

Still getting the error message in enso-win-x64-2024.1.1-nightly.2024.4.30.exe

image

AdRiley avatar May 02 '24 15:05 AdRiley

Removing last node from the graph leaves behind code main =, which is invalid: image

The engine sends in on of executionContext/executionStatus messages that this is an invalid syntax. Which is expected.

Later, when I try to create a new node in an empty graph, the GUI sends executionContext/executeExpression for something in the component browser, and engine responds with an executionContext/executionFailed as expected. image

I believe that the problem is on the side of the GUI, that should ensure that once a graph is empty, it should not leave an empty block behind resulting in invalid syntax.

Akirathan avatar May 07 '24 08:05 Akirathan

After a discussion on Discord, we came to a conclusion that the following snippet:

main =

Should be semantically equivalent to:

main =
    Nothing

Also note that for parser, the assignment operator without rhs is not an error. For example, the following code:

main =
    operator1 =
    operator2 =

is parsed as

(BodyBlock #(() (Function (Ident main) #() () "=" (BodyBlock #((Function (Ident operator1) #() () "=" ()) (Function (Ident operator2) #() () "=" ())))) () ()))

After all, the problem can be solved on the Engine side somewhere in https://github.com/enso-org/enso/blob/develop/engine/runtime-parser/src/main/java/org/enso/compiler/core/TreeToIr.java#L248-L251

GitHub
Hybrid visual and textual functional programming. Contribute to enso-org/enso development by creating an account on GitHub.

Akirathan avatar May 07 '24 09:05 Akirathan

Unassigning, because once engine will support empty function blocks, the GUI should work just fine. If it won't just reassign -gui and me.

farmaazon avatar May 07 '24 11:05 farmaazon

Because we don't implicitly import builtins, the following code

main =

will fail with error: The name Nothing could not be found.

4e6 avatar May 22 '24 14:05 4e6

Because we don't implicitly import builtins, the following code

main =

will fail with error: The name Nothing could not be found.

But this code

main =
    operator2 = 13

Does not fail with any error, while still returning Nothing.

farmaazon avatar May 22 '24 15:05 farmaazon

Ok, that makes sense, so the

main =

should result in

main = ()

where () is an empty block that when evaluated, result to Nothing

4e6 avatar May 22 '24 15:05 4e6

Dmitry Bushev reports a new STANDUP for today (2024-05-23):

Progress: Started working on the issue. Investigating what is happening during the execution of a method with an empty body. Added support for functions with empty bodies in parser. Working on the runtime support for empty method bodies. It should be finished by 2024-05-25.

Next Day: Next day I will be working on the #9172 task. Continue working on the task

enso-bot[bot] avatar May 23 '24 17:05 enso-bot[bot]