Beware – Non-English speakers be aware that this short story plays with word meanings. Since PureBasic community is a multi-language community every effort has been made to simplify the story so that it be understood equally well by non english speakers. This is fiction. Enjoy!
Amílcar Matos Pérez – author
San Juan, Puerto Rico
(c)2016 AMP All rights reserved. Free to copy and translate with authorship acknowledgment.
Introduction – Deep inside the PB 5.40 compiler live a long and complex string of bits, a new electronic life form. Thanks to the Help file we get to know them.
#Empty$ - Hi! #Null$.
#Null$ - (in a sad voice) Hi. #Empty$.
#Empty$ - How things are going?
#Null$ - Well, i’m depressed.
#Empty$ - Why? Look... the computer is off; RAM is empty nothing to bother us.
#Null$ - Yeesss..., but nothing is unemployed. You and I found work with PB 5.40 compiler, but nothing was left out.
#Empty$ - How come is that? We all are equal, right?
#Null$ - Wrong, my friend. We are not equal. Coders believe we are equal but we are not. We are not constant at all!
Test code:
Code: Select all
UserMessage$ = "Both constants are different."
If #Empty$ = #Null$
UserMessage$ = "Both constants are equal."
EndIf
MessageRequester ("Info", UserMessage$, #mb_iconexclamation)
End
#Empty$ - But, but; I’m always empty, i do a constant job.
#Null$ - Sure and me too.
Test code:
Code: Select all
VarOne$ = #Empty$
VarTwo$ = #Null$
UserMessage$ = "Both variables are different."
If VarOne$ = VarTwo$
UserMessage$ = "Both variables are equal."
EndIf
MessageRequester ("Info", UserMessage$, #mb_iconexclamation)
End
EnableExplicit - Hello guys! How are things going?
(Silence, full of #Empty$ comments and #Null$ expressions.)
EnableExplicit - Very well. Everything seems in order. Bye, guys.
#Null$ - See, our work makes the compiler happy.
Test code:
Code: Select all
EnableExplicit
Define VarOne$
Define VarTwo$
Define UserMessage$
Define UserMessage1$
Define UserMessage2$
Define UserMessage3$
Define UserMessage4$
; this code block illustrates the instructions to free a variable completely.
; VarOne$ is kept alive as an empty variable.
VarOne$ = #Empty$
; VarTwo$ is freed completely.
VarTwo$ = #Null$
; Show content of both variables.
; VarOne$ works as it is expected.
Debug "Empty VarOne = " + VarOne$
Debug "VarOne content = " + Asc(VarOne$)
Debug "VarOne length = " + Len(VarOne$)
Debug ""
; The next statement should not work since enable explicit is active and
; the variable has already been [completely freed!].
; "freed" is understood as erased, deleted, non existent, undefined.
; with enable explicit active a compilation error is expected.
; but no compilation error is raised.
Debug "Null VarTwo = " + VarTwo$
Debug "VarTwo content = " + Asc(VarTwo$)
Debug "VarTwo length = " + Len(VarTwo$)
Debug ""
UserMessage1$ = "Both variables are different."
If VarOne$ = VarTwo$
UserMessage1$ = "Both variables are equal."
EndIf
UserMessage2$ = "VarTwo with null value is different to empty constant."
If VarTwo$ = #Empty$
UserMessage2$ = "VarTwo with null value is equal to empty constant."
EndIf
UserMessage3$ = "VarOne with empty value is different to null constant."
If VarOne$ = #Null$
UserMessage3$ = "VarOne with empty value is equal to null constant."
EndIf
UserMessage4$ = "Both constants are different."
If #Empty$ = #Null$
UserMessage4$ = "Both constants are equal."
EndIf
UserMessage$ = UserMessage1$ + #LF$ +
UserMessage2$ + #LF$ +
UserMessage3$ + #LF$ +
UserMessage4$ + #LF$
MessageRequester ("Info", UserMessage$, #mb_iconexclamation)
End
#Null$ - Oh, no, no! I’m not depressed because of that.
#Empty$ - Then, why?
#Null$ - Because the compiler left nothing out.
#Empty$ - I don’t understand you, i feel myself blank.
#Null$ - I expected nothing... become a constant like you and me.
#Empty$ - Look i know nothing. Nothing can delete variables, procedures even modules. The Team just output nothing from the code section.
#Null$ - Exactly! And nothing now lives happy in the comment section been himself and where nothing it do.
#Empty$ - Don’t worry he is happy been himself and doing nothing.
#Null$ - Maybe, anyway...; I’m a constant and i’m suppossed to free a variable completely (help file says so). Once i do my job the variable should be deleted, vanished, non-existent; for that i need nothing. Since variables still exists after i do my job that means nothing was left out of work.
So, my work is exactly the same as yours and you know what will happen in a future update..., i will be deleted.
I just don’t know what i will then do, as i need the job!
#Empty$ - Now don’t be so sad. You know how PureBasic coders are. They truly are quality coders, they will learn to like you and they need you to document their API accesses. So they will not let the Team unemploy you. Cheer up friend.
Come on read History page (16th October 2015 : Version 5.40) There it says;
Added: #Null$ special string constant to affect a real null value to a string (To free it completely). It can be used as well for API functions which sometimes accept NULL instead of a string address.
#Null$ - #True says the same and i hope they’ll retain me. It’s just #False who says that the Team will delete you instead of me.
#Empty$ - Delete me! Hmmm...; HA!... ha, ha!!
#Null$ - What are you laughing at?
#Empty$ - It would be meaningless, and pointless to delete me. How are they going to tell the coders of the world in their next update?
Deleted - #Empty$.
See the entry is empty, instead of me, nothing was deleted.
The End.
Reference – http://www.purebasic.fr/english/viewtop ... t=%23Empty
On the serious side, this story also plays with the different perspectives on the way constants should work and be understood, no offense intended. Please understand this lightly as my purpose is to amuse, not to critique or offend in any way whatsoever.
Admin, please, if anyone feels hurt or offended by this story feel free to erase it completely. Thank you.