Re: lingo-l TRUE or FALSE
On Sunday, October 5, 2003, at 08:46 PM, [EMAIL PROTECTED] wrote: Setting vars to void on purpose makes absolutely no sense to me. It never has and it probably never will. Void means I haven't even been touched by code yet, so don't use me, while some other value (0 pr #null or ) means *something* has manipulated the variable and the person who wrote the code stands a reasonable chance of knowing what its value is (or should be) from line to line in the code that handles it. That implies a programmer who knows what his code is purportedly doing at all times, and it's the kind of person I'd be more likely to want working on a project. I pretty much agree. But let me play devil's advocate. When I kill an object, a timeOut, a MIAW, or something else I want to be rid of permanently, is there a harm in setting the holder variable to void? I know the same thing can be done by setting the variables to 0, but is there any harm in voiding them? That's assuming, of course, that you (1) won't be using the variable again, or (2) you know that, if it's void, the object doesn't exist. That's a little like asking if there's harm in not providing internal documentation for your code, or so I believe. Again, to me void means uninitialized, which basically translates to programmer or program error. A variable that is *expected* to live part of its life with a void value means that the code generating or handling it is probably not rigorously defined, at least by my (admittedly uptight) standards. There's no *harm* per se, but if someone who happens to follow my philosophy comes along he might wonder what went wrong with the code at some point: Huh, look at all these voids... Thing is that putting a 0 or #null or into a variable lets you (and other programmers) know that you know the var exists, that you've got code handling it, etc. Void doesn't have the same quality of awareness to it. So no, not *harmful* like not documenting your code isn't harmful either, but possibly a little, er, careless. Can I work on your project? ^_^ Heck, not if I have to go through all these explanations first of the value of knowing what's in your variables at all times... ;) Warren Ockrassa | President, nightwares LLC [EMAIL PROTECTED] nightwares LLC | Consulting Programming http://www.nightwares.com/ Author | Director 8.5 Shockwave Studio: A Beginner's Guide Chapter samples | http://www.nightwares.com/director_beginners_guide/ [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
Re: lingo-l TRUE or FALSE
Hi Warren, I prefer maintaining type consistency of what a variable or a return value will be. If an object is cleared, I want it to be a cleared object type. VOID is the closest thing we have in Lingo. #null is better than the integer zero but I still prefer VOID. (0 would drive me crazy. I'd be expecting an object type, and here would be an integer type.) To me, type consistency is a more powerful debugging aid than avoiding VOID. (As an aside, I don't consider VOID to be uninitialized data. Uninitialized data is what you get in C, when you can't tell predict what it is going to be. In Lingo, any time you declare a variable, it is initialized to VOID.) Regards, Daniel [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
lingo-l TRUE or FALSE
Hi Lingo's! I wonder is there a significant difference between assigning to property variables 0 or 1 values or TRUE or FALSE ones? For example: property pCurrentSprite property pPrevSprite on beginSprite me pCurrentSprite = 1 --(or TRUE?) pPrevSprite = 0 --(or FALSE?) end Just to be sure I stated it clearly. I don't want to assign a value to a variable (like 56 or whatever) I just want to state its boolean property. P.S. After writing this I thought to myself: but how does Lingo know how to distinguish 1 in the meaning of boolean, than of the value? Hmm Thanks in advance [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
Re: lingo-l TRUE or FALSE
Lingo doesn't have a boolean variable type. A true is considered an integer 1. Easy test: testVar =TRUE put testVar -- 1 testVar =FALSE put testVar -- 0 For the purposes of testing (expression evaluation), any non-zero value is considered TRUE. At 05:47 AM 10/5/03, Peter Bochan wrote: Hi Lingo's! I wonder is there a significant difference between assigning to property variables 0 or 1 values or TRUE or FALSE ones? For example: property pCurrentSprite property pPrevSprite on beginSprite me pCurrentSprite = 1 --(or TRUE?) pPrevSprite = 0 --(or FALSE?) end Just to be sure I stated it clearly. I don't want to assign a value to a variable (like 56 or whatever) I just want to state its boolean property. P.S. After writing this I thought to myself: but how does Lingo know how to distinguish 1 in the meaning of boolean, than of the value? Hmm Thanks in advance [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!] [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
Re: lingo-l TRUE or FALSE
As the others say, there isn't a difference. I would pretty well always say x = false if I was using x as a Boolean, if only for readability. You can rely on true or false being an integer though. Here for example is how I usually do movement of an object using the arrow keys (say for a tank in Space Invaders): x = x - keypressed(123) + keypressed(124) If just the left arrow is pressed, x decrements, just the right arrow and x increments, and if both are pressed is stays the same value. [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
Re: lingo-l TRUE or FALSE
At 7:40 AM -0400 10/5/03, you wrote: Lingo doesn't have a boolean variable type. A true is considered an integer 1. Actually, TRUE = anything non-zero ( VOID since that's also treated as zero) for instance: x = 3 if x then -- code in here will get evaluated end if hth -Buzz Easy test: testVar =TRUE put testVar -- 1 testVar =FALSE put testVar -- 0 For the purposes of testing (expression evaluation), any non-zero value is considered TRUE. At 05:47 AM 10/5/03, Peter Bochan wrote: Hi Lingo's! I wonder is there a significant difference between assigning to property variables 0 or 1 values or TRUE or FALSE ones? For example: property pCurrentSprite property pPrevSprite on beginSprite me pCurrentSprite = 1 --(or TRUE?) pPrevSprite = 0 --(or FALSE?) end Just to be sure I stated it clearly. I don't want to assign a value to a variable (like 56 or whatever) I just want to state its boolean property. P.S. After writing this I thought to myself: but how does Lingo know how to distinguish 1 in the meaning of boolean, than of the value? Hmm Thanks in advance [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!] [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!] [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
Re: lingo-l TRUE or FALSE
At 03:28 PM 10/5/03, Buzz Kettles wrote: At 7:40 AM -0400 10/5/03, you wrote: Lingo doesn't have a boolean variable type. A true is considered an integer 1. Actually, TRUE = anything non-zero ( VOID since that's also treated as zero) for instance: Yes, as I indicated in my statement For the purposes of testing (expression evaluation), any non-zero value is considered TRUE.. When I said a true is considered an integer 1, I meant specifically the value given to the keyword TRUE, which is why I clarified the part about expressions later on in my email, which I know you read, right Buzz? :) x = 3 if x then -- code in here will get evaluated end if hth -Buzz Easy test: testVar =TRUE put testVar -- 1 testVar =FALSE put testVar -- 0 For the purposes of testing (expression evaluation), any non-zero value is considered TRUE. [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
Re: lingo-l TRUE or FALSE
At 4:15 PM -0400 10/5/03, you wrote: At 03:28 PM 10/5/03, Buzz Kettles wrote: At 7:40 AM -0400 10/5/03, you wrote: Lingo doesn't have a boolean variable type. A true is considered an integer 1. Actually, TRUE = anything non-zero ( VOID since that's also treated as zero) for instance: Yes, as I indicated in my statement For the purposes of testing (expression evaluation), any non-zero value is considered TRUE.. When I said a true is considered an integer 1, I meant specifically the value given to the keyword TRUE, which is why I clarified the part about expressions later on in my email, which I know you read, right Buzz? :) Sorry Tab - you guessed right - I scanned too fast - I knew you knew better was surprised jumped in too fast - no more info was needed. thanks x = 3 if x then -- code in here will get evaluated end if hth -Buzz Easy test: testVar =TRUE put testVar -- 1 testVar =FALSE put testVar -- 0 For the purposes of testing (expression evaluation), any non-zero value is considered TRUE. [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!] [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
Re: lingo-l TRUE or FALSE
Actually, TRUE = anything non-zero ( VOID since that's also treated as zero) Ooh, Buzz, be careful there. I found out the hard way not to treat VOID as 0 or false. It most definitely is not. I reported this about 18 months ago, and it raised quite a ruckus. It is treated differently on Windows and Mac. I had a 2-day bug in an inherited project on 8.5 that I finally tracked down to this. I forget the exact code, and I can't wade through 4,000 lines of legacy code to track it down at the moment, but it was something like: if NOT (pSomeValue) then or it may have been: if pSomeValue and it evaluated to true on Windows, false on Mac. Whatever the case, if you're going to use a variable in a boolean, and there is any chance at all it could be void, do a check for voidP first. Cordially, Kerry Thompson [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
Re: lingo-l TRUE or FALSE
On Sunday, October 5, 2003, at 06:19 PM, [EMAIL PROTECTED] wrote: Actually, TRUE = anything non-zero ( VOID since that's also treated as zero) Ooh, Buzz, be careful there. I found out the hard way not to treat VOID as 0 or false. It most definitely is not. I reported this about 18 months ago, and it raised quite a ruckus. It is treated differently on Windows and Mac. I had a 2-day bug in an inherited project on 8.5 that I finally tracked down to this. I forget the exact code, and I can't wade through 4,000 lines of legacy code to track it down at the moment, but it was something like: if NOT (pSomeValue) then or it may have been: if pSomeValue and it evaluated to true on Windows, false on Mac. Whatever the case, if you're going to use a variable in a boolean, and there is any chance at all it could be void, do a check for voidP first. Yeah, I might have contributed to this ruckus too. I consider it bad design to let any variable have a void (i.e., uninitialized) value. ;) Deliberately setting a variable to void seems just screwy to me. Warren Ockrassa | President, nightwares LLC [EMAIL PROTECTED] nightwares LLC | Consulting Programming http://www.nightwares.com/ Author | Director 8.5 Shockwave Studio: A Beginner's Guide Chapter samples | http://www.nightwares.com/director_beginners_guide/ [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
Re: lingo-l TRUE or FALSE
Yeah, I might have contributed to this ruckus too. I consider it bad design to let any variable have a void (i.e., uninitialized) value. ;) I couldn't agree more. Some other languages will automatically initialize variables for you--I think Lingo doesn't because it's so loosely typed (read: untyped). You get the hairy eyeball, though, when you're expecting a return value from a function, and it doesn't return anything. It took me two days to track my bug down because there was a long and tortuous code path to and from a function being built on the fly. In certain cases, the function was never built, so there was no return, ergo a void variable. Deliberately setting a variable to void seems just screwy to me. That makes sense. But since Lingo variables aren't typed, or even declared, the compiler doesn't have a chance to initialize it. Here's a scenario: x = anObject.mAHandler mAHandler gets its value from objectB.mAnotherHandler, which in turn gets its value from objC.mYetAnother, and so on down the line. Something at the end of the call chain is supposed to return a value. But, because of an exponential number of branches, you can't be sure you'll eventually get a return. You gotta check for voidP then. If Lingo required you to at least declare variables before you use them, it could assign a value at compilation. With Lingo's ability to declare variables on the fly, though, I'm not sure how it could do that. Cordially, Kerry Thompson [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
Re: lingo-l TRUE or FALSE
Setting vars to void on purpose makes absolutely no sense to me. It never has and it probably never will. Void means I haven't even been touched by code yet, so don't use me, while some other value (0 pr #null or ) means *something* has manipulated the variable and the person who wrote the code stands a reasonable chance of knowing what its value is (or should be) from line to line in the code that handles it. That implies a programmer who knows what his code is purportedly doing at all times, and it's the kind of person I'd be more likely to want working on a project. I pretty much agree. But let me play devil's advocate. When I kill an object, a timeOut, a MIAW, or something else I want to be rid of permanently, is there a harm in setting the holder variable to void? I know the same thing can be done by setting the variables to 0, but is there any harm in voiding them? That's assuming, of course, that you (1) won't be using the variable again, or (2) you know that, if it's void, the object doesn't exist. Can I work on your project? ^_^ Cordially, Kerry Thompson [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
lingo-l TRUE or FALSE - solved
Thanks you folks for answers. [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]