07-09-2023, 08:31 PM
TYPEs are always global, as per the odd behavior which QB45 had with them back in the day.
I think the reason was that some of the programmers back in those days used to write TYPE libraries and then just include them willy-nilly into the code whenever they needed them. (Think of a TYPE point: X AS INTEGER: Y AS INTEGER: END TYPE) No matter where you put those type statements, they tend to produce global variable types for use.
And, honestly speaking, I'm not certain if you'd want it any other way. Can you imagine the confusion of writing a library with a POINT type, and making it 2D, while someone else creates a library with a POINT type and makes it 3D? If that's not a recipe for confusion and utter programming frustration, I don't know what would be!
I think the reason was that some of the programmers back in those days used to write TYPE libraries and then just include them willy-nilly into the code whenever they needed them. (Think of a TYPE point: X AS INTEGER: Y AS INTEGER: END TYPE) No matter where you put those type statements, they tend to produce global variable types for use.
And, honestly speaking, I'm not certain if you'd want it any other way. Can you imagine the confusion of writing a library with a POINT type, and making it 2D, while someone else creates a library with a POINT type and makes it 3D? If that's not a recipe for confusion and utter programming frustration, I don't know what would be!