Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TYPE and CONST within SUB/FUNCTION
#2
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!
Reply


Messages In This Thread
RE: TYPE and CONST within SUB/FUNCTION - by SMcNeill - 07-09-2023, 08:31 PM
RE: TYPE and CONST within SUB/FUNCTION - by bplus - 07-10-2023, 12:30 AM
RE: TYPE and CONST within SUB/FUNCTION - by bplus - 07-10-2023, 12:55 AM
RE: TYPE and CONST within SUB/FUNCTION - by bplus - 07-11-2023, 01:22 AM



Users browsing this thread: 2 Guest(s)