Skip to content

Better error handling for FUNCTION/SUB/GOSUB/RETURN clashes + underflow.Β #37

@flagxor

Description

@flagxor

The current implementation of FUNCTION/SUB/GOSUB/RETURN assumes that they are only
used in the correct order and never underflow.
Someone needs to investigate what the "correct" behavior in various canonical BASICs is when mixing GOTO / GOSUB / RETURN with FUNCTION/SUB.
I.e. can you do:
FUNCTION Foo(x)
GOTO Yikes
END FUNCTION

FUNCTION Bar(x)
Yikes:
Bar = 3
END FUNCTION

And if so, what does it do?
Same question with GOSUB/RETURN.

It may be even if allowed in interpreters, that this is just too weird and we should scream with an error.
But it would be good to know what's canonical and document if we deviate.

We should probably also check for under/overflow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions