Global Static Dim - omitted from compiler processing.

Started by atomix, Sep 28, 2022, 02:07 PM

Previous topic - Next topic

atomix

Proc Task_my(value As Byte)
    Global Dim my1 As Byte = 1                 ' ok

    Static Dim my2 As Byte = 2                 ' ok

    Global Static Dim my3 As Byte = 3          ' error
EndProc

How then in the procedure to declare "Global Static Dim"?

John Lawton

Why are you trying to create a global variable in a Procedure?

The 8 bit manual states:
"Any label, constant or variable created within a procedure is local to that procedure only. Meaning that it is only visible within the procedure, even if the name is the same as other variables created in other procedures, or global constants or variables."

That appears to rule out creating global variables?

atomix

I'm working on a new big update to the VSCode Positron Extension and tweaking the text parsing rules.

That's why I'm asking, is this a compiler error or is this an invalid expression.

Les say a comment on this.

top204

Global and Static directives combined have not been added to the compiler's Parser yet.

The Global directive within procedures is still in its Beta stage, which is why it is not in the manuals, so it was not valid to assign Static to them until I am happy with them working as they should. So that two problems are not merged if an anomaly occurs and I am then not able to tell which one is causing the anomaly. :-) It would be similar to having an equation something like: "X + Y = ?", where X and Y could be any value whatsoever, but the final answer would still be, technically, correct and incorrect in differing circumstances. :-)