Since Structure definitions are global to the program, and not to Procedures, there should be forbidden to define structures inside Procedures, "imho".
Since this is a Feature Request we are referring to what is desired, not what currently is.
They currently are global and should thus find reason to be forbidden, at present. However, they can currently be declared in a procedure the same way as a global variable declaration:
Code: Select all
Procedure Test()
Global variable.b,variable2.w
Define l.l,f.f
...
EndProcedure
With variables, they are treated as local if declared in a procedure unless they are specified Global. I don't see why this could not be accomodated for Structure declarations also. Perhaps like this:
Code: Select all
Procedure Test()
Global Structure Foo
variable.b
variable2.w
EndStructure
Structure Foo2
l.l
f.f
EndStructure
...
EndProcedure
Perhaps the reverse would work better, "Local Structure". In that case it would be assumed to be Global unless declared local.
Code: Select all
Procedure Test()
Structure Foo
variable.b
variable2.w
EndStructure
Local Structure Foo2
l.l
f.f
EndStructure
...
EndProcedure
I would favor a single keyword such as Global_Structure or Local_Structure instead of a combination of keywords like "Global Structure" or "Local Sturcture."
I would favor more the treating of a Structure definition as local if declared in a Procedure, otherwise it would be global. For naming conflicts where there is a global and a local structure using the same name, the local one would get priority within the procedure.