Mistrel wrote:This is still a major, major headache, not to mention that it's just not as pleasant to read as the older code.
I agree, because the change isn't "logical". And it probably breaks a lot of code, given that PB has been around for 10 years.
The illogical thing about this change is that numeric data types are also not true binary state items. There is no such thing as a true 1-bit data type. An 8-bit byte can have 256 states and a 32 bit integer can have millions, but it's only a convention that 0 means false and everything else means true. So why is it wrong to assume that an empty string is false, and a non-empty string is true?
@PB
Like you I use macros to make my code more readable and to make it obvious that I'm making binary decisions. I've always used macros in my code to hide constructs that don't conform to standard coding practices. This can be really helpful when handling language "improvements", or when converting from one language to another. These days, my code tends to look like a perverted cross between Fortran, Algol, Basic, and Cobol.
Code: Select all
;
;===============================================
;
; Macro 107 : true if the item is an object
;
Macro IsObject (bvsDataParmName)
bvsDataParmName <> 0
EndMacro
;
;===============================================
;
; Macro 108 : true if the item is not an object
;
Macro NotObject (bvsDataParmName)
bvsDataParmName = 0
EndMacro
;
;===============================================
;
; Macro 109 : an empty string value
;
Macro Null
#sNULL_STRING
EndMacro
;
;===============================================
;
; Macro 110 : true if a string is empty
;
Macro IsNull (bvsDataParmName)
bvsDataParmName = #sNULL_STRING
EndMacro
;
;===============================================
;
; Macro 111 : true if a string is not empty
;
Macro NotNull (bvsDataParmName)
bvsDataParmName <> #sNULL_STRING
EndMacro
;
;===============================================
;
; Macro 112 : true if an expression is not zero
;
Macro IsTrue (bvsDataParmName)
bvsDataParmName <> 0
EndMacro
;
;===============================================
;
; Macro 113 : true if an expression is zero
;
Macro IsFalse (bvsDataParmName)
bvsDataParmName = 0
EndMacro
;
;===============================================
;
; Macro 114 : return a true value: -1
;
Macro True
#lVALUE_TRUE
EndMacro
;
;===============================================
;
; Macro 115 : return a false value: 0
;
Macro False
#lVALUE_FALSE
EndMacro
;
;===============================================
;
; Macro 116 : true if the object is not at end of file
;
Macro NotEof (bvsObjectName)
IsFalse(Get(bvsObjectName, exlEndOfFile))
EndMacro
;
;===============================================
;
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan