Re: lingo-l The value of void?
- Original Message - From: Tim MacDonald [EMAIL PROTECTED] t = call(#undefined, the actorList) put t -- Null (This is one way I know of producing this value -- I'm sure there are others) put ilk(t) -- #void [snip] Is this an example of a dirty void? Or just another lingo idiosyncracy? Interesting, you could be onto something here. I thought NULL was just a synonym for VOID, but not so it would seem. It's interesting that ilk and voidP() give different results. Here's my own version of your tests: a = call( #undefined, [] ) put a -- Null put voidP(a) -- 0 put ilk( a, #void ) -- 1 put a=true -- 0 put afalse -- 1 ( I wonder if you get the same results on the Mac? ) I don't know whether the difference between ilk and voidP is intentional so people can distinguish VOID from NULL, or if that is a bug in voidP. Certainly it seems a bit strange that the ilk should be called #void if it is not of the #void type. Actually, this result makes me suspect that all 0's is a NULL, and VOID has a different ilk bytecode - either that or VOID has a special integer code, and both NULL and VOID really are of type #void. I say this since it's unlikely that a random return code that is anything other than zero would result in a type such as NULL, it would more likely result in a random number or something. It's much more likely that the default undefined return code is binary zero. One notable point here is that Kerry's fix would not work in this case, because voidP does not work. You'd need to use this instead: if( ilk( nullVar, #void ) ) then nullVar = false - Robert [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 The value of void?
- Original Message - From: Kerry Thompson [EMAIL PROTECTED] Then you will get different results depending on the apparently random output from this function with a single known input. That's not good from an engineering POV. Ah, but you will get consistent results with your code. You're testing for void first, just like I found I needed to do. No, that's not the problem here. The problem is that value() *randomly* returns 0 or VOID, when it should clearly always return one or the other (it doesn't matter which, as long as the same input gives the same output). Secondly, I am quite aware of the exact nature of VOID. VOID is a special type/value. The VOID /type/ can have one value: VOID. The /value/ VOID is numerically equivalent to the value 0 for the integer type, or 0.0 for the floating point type. These are not /identical/, because the types are different. However, there is implict casting between all 3 types for all arithmetic and logical operations in Lingo. As I said before, 0 = 0.0 = VOID. However, 0 !== 0.0 !== VOID. VOID is not the absense of a value at all, it is a perfectly valid value. The only problem with that statement is that in practise it can cause problems with list properties whose values are set as VOID since Lingo doesn't have any good functions to /distinguish/ between that condition and the complete absence of the property. I'm talking about the fact that getaProp returns VOID for non-existant properties, and this is sometimes the only way to check. This could be solved by the addition of an isAProp proplist function, but its not something that can be done in Lingo, it must be added to the language. BTW, you should not confuse VOID in Lingo with void in C: they are quite different. In C it /does/ indicate the absence of a value (but don't confuse a void pointer with a null pointer either, they are also quite different). However, the C void keyword has two possible and quite different meanings, depending on the context, but there is no VOID type, nor is there a VOID value. Regarding your bug, I'm *very* surpised if MACR marked: if( VOID ) then -- Never execute this code -- But it runs on Windows end if as NAB, because it clearly is a bug, if the above statement were true. However, it doesn't evaluate as true on any Windows system I've ever tested (I even double checked on mine just now to be sure). I expect that the bug actually lay in your conditional expression, which may not have been returning VOID as you believe. I'd be interested to see the /exact/ conditional expression though, if you still have a note of it. - Robert [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 The value of void?
At 22:46 Uhr -0500 01.04.2003, Kerry Thompson wrote: In the code that started this thread, we were checking the value of an empty string. and at the end of the thread several macromedia engeneers abandoned the list, as I recall... ;-) -- ||| a¿ex -- [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 The value of void?
Have you tried using integer() --returns void (unsure of consisitency; I'd be interested in other people's tests. btw, value() is consistently returning 0 at this time on this machine) or float() --returns (ditto to above) ? One way I have checked for valid user entries of numbers is floatP(float(user string)) or integerP(integer(user string)), depending on the data type requested. 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!]
Re: lingo-l The value of void?
arithmetic and logical operations in Lingo. As I said before, 0 = 0.0 = VOID. However, 0 !== 0.0 !== VOID. Interestingly, this was not true in Director 8. In D8, VOID 0.0, though it does = 0. This change introduced a bug in a program when I upgraded to D8.5 (an easy to locate and fix bug, thankfully). This highlights one reason why we should not rely on any internal definition of VOID, using voidP() instead (I also use direct comparison to VOID so it can be included in case statements). Also interesting is that explicit integer() and float() casts leave VOID as VOID. -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!]
Re: lingo-l The value of void?
On Wednesday, Apr 2, 2003, at 10:42 America/Chicago, Robert Tweed wrote: BTW, sorry if you took offense at my comments, they are more a question of disbelief that Macromedia would regard VOID = true as not a bug than anything to do with your own credibility - though we do all make mistakes, which is easier to believe. It's not that void = true; it's that in some cases implicit testing can lead to erroneous positives. I can believe what you say is true, but I still don't accept the logic. VOID = 0 = false, always. As far as I am concerned, that is, or should be, gospel. But void is not zero, any more than, in C: int foo; makes foo a valid variable. You don't know what's in it and testing it without first stuffing a value into it: int foo = 3; can lead to all kinds of weird problems. I guess I'm looking at it from a somewhat different perspective in that void = undefined, which is not the same thing as either 0 or false. It smells to me more like programmer error. :\ In that light perhaps individual reaction to these results is based on perspective or what one expects from a language -- when we have tests such as voidP, integerP, floatP, stringP and so on, though, it seems to me that it's most advisable to use these tests to preprocess variable contents before we start implicitly assigning actions based on boolean assumptions that can go wrong simply because of unexpected type coercion. You might also see that I'm of the don't ever do that frame of mind in re handling voids and assuming them to have any useful (or at least non-void) value at all. ;) To me void = void, not 0 or false or or [:] or anything else, so testing it implicitly for a boolean value, to me, is an error in procedure. Presumably the bug can be reproduced on any affected system with: a = VOID if( a ) then alert( This system has a BUGGY implementation of Lingo, no matter what Macromedia may say ) end if It shouldn't matter what the steps leading up to this point are, since VOID is VOID is VOID, no? Void is void but it's not necessarily true *or* false. The above might be better written as if not voidP ( a ) then if a then alert etc. end if end if Implicitly casting a void as a boolean is risky. Director doesn't seem to handle the coercion with complete consistency. For that reason the best thing to check for is a voidP or, barring that, an explicit test for a boolean: if a = TRUE then alert etc. end if rather than allowing Director to try to infer what you mean by context. Warren Ockrassa | consulting | programming | [EMAIL PROTECTED] nightwares LLC | http://www.nightwares.com/ Developer | Structor, a presentation development/programming tool Info and demo | http://www.nightwares.com/structor/ 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 The value of void?
That's an interesting conclusion, which I would argue with. A lot of people did ^_^ As I said, the debate became rather acrimonious, to the point that some people, including MM engineers, left the list. Several people on the list now were around for the brouhaha--Alex de Franca remembers ^_^ From where I stand, it's an open question as to whether it is a bug or not. Personally, I tend to agree with you, since it gives different Xplat results. The NAB was Macromedia's ruling. I might check the documentation Don't bother. Your search will return void. JOOI, on a system that does exhibit this bug (and I am still regarding it as a bug, especially since it varies between platforms), what would be the result of (VOIDfalse) ? Presumably the bug can be reproduced on any affected system with: a = VOID if( a ) then alert( This system has a BUGGY implementation of Lingo, no matter what Macromedia may say ) end if It shouldn't matter what the steps leading up to this point are, since VOID is VOID is VOID, no? True, except when it's NULL ;-) x=NULL put x -- Void Actually, that jogs my memory a bit. The syntax may not have been if NOT x. It could have been if x = FALSE that gave the inconsistent results. Sadly, I don't even have the code here to double-check. We were building a command proc on the fly, and one of the methods in one of the objects (HUGE Coop program) was expecting a return value, and I discovered that, under certain circumstances, the command proc didn't return anything. I can't reproduce it now either, on the systems I have. I wish I could. The bottom line, though, is that you should check for voidP before doing any Booleans, at least in Lingo. In another post, I mentioned that void was the absence of a value, and you said that it is a specific value. Actually, I think we're both correct. I don't have my Kernighan Ritchie handy (we just moved, and boxes are everywhere), but C and Lingo do treat it differently. I was going by Macromedia's documentation, which says voidP determines whether the variable specified by variableName has any value. Since this is a Lingo list, I was referring to void in Lingo. You're right in other contexts, though. Maybe we should all go back to twiddling bits in 6502 assembler. 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 The value of void?
[EMAIL PROTECTED] wrote: Will someone please decide once and for all what value(void) will return? I've got three different results, all on the same machine. VOID can't be used at the right of a comparison operator without getting a value. This value is zero. I'd suggest you use voidP() to check out if a var is void. To know more about numeric data encoding see ANSI/IEEE 754 standard for Binary Floating-Point Arithmetic. Also, it treats separately certain types of numbers like infinites, NaNs, zeroes, normal and denormal numbers. Franco IFC Programming Consultant http://www.chnexus.com/athroon~/index.htm [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 The value of void?
[ Long email warning - some may find the low-level programming stuff at the end interesting, others may want to avoid ] - Original Message - From: Kerry Thompson [EMAIL PROTECTED] As I said, the debate became rather acrimonious, to the point that some people, including MM engineers, left the list. Several people on the list now were around for the brouhaha--Alex de Franca remembers ^_^ I'm sure it was due to the shame of having to follow the party line on this whole VOID=true business. That *is* what it comes down to - they are saying that VOID is undefined when that is simply not true, except in a buggy language implementation. I might check the documentation Don't bother. Your search will return void. :-) True, except when it's NULL ;-) x=NULL put x -- Void AFAIK, NULL is simply a constant representation of the VOID type - the same as TRUE in Lingo is actually the integer 1 and FALSE is the integer 0. Some other loosely typed languages such as PHP actually have a boolean type, so FALSE !== 0. TRUE is a more complex one than =1 or != 1, since TRUE is generally represented by -1 since that is the bitwise inverse of FALSE (0). At least, most C programmers do it that way, more out of convention than anything (much like the convention to use the variable name me in Lingo instead of the more traditional this in all other OOP). I can't reproduce it now either, on the systems I have. I wish I could. The bottom line, though, is that you should check for voidP before doing any Booleans, at least in Lingo. That's a shame. At the very least, it is undesirable behaviour. I would still regard it as a bug, even if Macromedia were too lazy to fix it that week. What should happen in any aritmetic expression is that types should follow a known order of implicit up-casting. For instance, VOID upcasts to int, and int upcasts to float, wherever required to do so by an arithmetic or logical operator. Not doing this somewhat limits the usefulness of any scripting language. There is no point in a scripting language that /requires/ type checking before every statement. You might as well write all your code in C or Java because at least then you'd know what the types are in advance. In another post, I mentioned that void was the absence of a value, and you said that it is a specific value. Actually, I think we're both correct. I don't have my Kernighan Ritchie handy (we just moved, and boxes are everywhere), but C and Lingo do treat it differently. I was going by Macromedia's documentation, which says voidP determines whether the variable specified by variableName has any value. Since this is a Lingo list, I was referring to void in Lingo. You're right in other contexts, though. Maybe we should all go back to twiddling bits in 6502 assembler. - From: Howdy-Tzi [EMAIL PROTECTED] But void is not zero, any more than, in C: int foo; makes foo a valid variable. You don't know what's in it and testing it without first stuffing a value into it: int foo = 3; can lead to all kinds of weird problems. Just to get the record completely straight on the different meanings of void or VOID - the following is a lengthy and technical discussion of points that you may all be aware of, but may also clear up a few ambiguities: In C everything is typed. So, the declaration: int foo; Allocates a 2-byte block of memory and foo is set as a static pointer to that memory location. However, what that statement does not do, is put any specific value in the 2-bytes of memory, so at runtime it could contain anything. This is known as undefined - that is *not* a specific value (unlike VOID), nor is it the absence of value either, it is the absence of prior *knowledge* of what the value should be. int foo = 3; Does exactly the same, except that it always starts with 0x0003 in the 2 bytes set aside for the variable foo, so we know what the value is. The keyword void in C is also unlike VOID in Lingo. In C, this indicates an unknown, or don't care value. There are 2 possible uses, one to indicate that a function does not return a value, and another which is the void pointer: void *voidpointer = 0xb800; This example is a base-address pointer to the colour text mode video memory on the PC. Pointer aritmetic on a void pointer is performed in bytes, so *( voidpointer + 100 ) means the value at the 100th byte in the video memory. However, since the pointer is void, we don't know how many bytes to read from that base address, so some casting is required (often done implicitly by the compiler when the pointer is assigned to a variable, but it depends on the strictness settings). This is different to typed pointers like: int *intpointer = 0xb800; in which pointer arithmetic operations are automatically multiplied by the size of the type. In this case sizeof(int) = 2, so (int)*( voidpointer + 100 ) is precisely equivalent to *( intpointer + 50 ). Internally that compiles into (int)*(
RE: lingo-l The value of void?
The fact that Macromedia are quite happy with a broken implemementation IMHO, seriously undermines the credibility of Lingo as a useful scripting language. I'm with you up to there, Robert. I read your post carefully, and your explanation is flawless. To be honest, I've done more assembler than C, and void isn't really a concept in assembly language, so I'll defer to your knowledge of C--clearly more detailed than mine. I stop short of saying it undermines Lingo's credibility, though. It's a known issue, with a known workaround, and just about every scripting language I've used has issues like this. Lingo remains a powerful and flexible language, albeit with some quirks. After all, that's what they pay us those big bucks for ^_^ PS: After writing this, I realised that my test-code probably wouldn't demonstrate the bug. Most likely a dirty VOID is being returned by a function, probably in an Xtra. In that case, the bug may well affect later versions of Windows, as well as the one that demonstrated the problem before, but it will only show up when the VOID contains a non-zero body. That corresponds with my experience. I believe I mentioned that I found the problem in a function call. This is way, way oversimplified, but it was essentially this: x = someFunction() if x = FALSE then -- do something else -- do something else end if on someFunction --do something --but don't return anything End It was absolutely consistent, though--that's the odd thing. The Boolean always evaluated to false on Mac, and true on Windows. I added one line, if voidP(x) then x = FALSE to fix the bug. So, a dirty VOID? That's the best explanation I've heard so far. Nuuj could tell us exactly what is going on, but he was one of the engineers who stomped off when some people misdirected their anger at him. 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 The value of void?
- Original Message - From: Kerry Thompson [EMAIL PROTECTED] I stop short of saying it undermines Lingo's credibility, though. It's a known issue, with a known workaround, and just about every scripting language I've used has issues like this. Lingo remains a powerful and flexible language, albeit with some quirks. After all, that's what they pay us those big bucks for ^_^ You mean we can get big bucks for this now? ;-) Actually, I do think it undermines Lingo's credibility, to a greater or lesser extent, depending on how you look at it. As you can probably tell, I like to know how things work, so when I write some code I know it's going to do what I expect it to do. I don't like lots of things being left undefined, just because the Macromedia engineers are too lazy to address what is clearly a bug, so they do a Microsoft a re-label it as a feature. Sorry, but in this case it's not acceptable, and it can seriously complicate what should otherwise be simple code. Scripting languages are for exactly that - writing simple elegant code that reads easily. They are not for writing mammoth chunks of code that explicitly work around every possible bug-causing case - the language itself is by design, supposed to negate the need for all that. You also made the point that we should test for an empty string before passing it to value(), but I don't see why that should be necessary either. Again this comes down the the amount of work we are expected to do in our scripts - really that work should be delegated the the built-in functions, so something like value() should always return a known value, it doesn't matter what, as long as it is consistent. I don't mind the return value being undefined if the input is not a string, but an empty string is still a string, so it's well within the function's working specification. [snip] That corresponds with my experience. I believe I mentioned that I found the problem in a function call. This is way, way oversimplified, but it was essentially this: x = someFunction() if x = FALSE then -- do something else -- do something else end if on someFunction --do something --but don't return anything End Ah, so rather than returning VOID it actually doesn't return anything - that's a bit different. You are basically returning an undefined value, which may or may not be VOID. Having said that, I believe Lingo does normally put a VOID in as the return value for you, which is really what it should do to make everything nice robust - no-one want's to deal with undefined's in a scripting language, which is why we have VOID in the first place. Anyway, if that is where the problem is creeping in, there is still no need for dirty VOIDs the be handled incorrectly. - Robert [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 The value of void?
At risk of exhausting people's patience with this thread, It shouldn't matter what the steps leading up to this point are, since VOID is VOID is VOID, no? True, except when it's NULL ;-) x=NULL put x -- Void t = call(#undefined, the actorList) put t -- Null (This is one way I know of producing this value -- I'm sure there are others) put ilk(t) -- #void put voidP(t) -- 0 put t = VOID -- 0 put t = NULL -- 0 put t = 0 -- 0 Is this an example of a dirty void? Or just another lingo idiosyncracy? Tim [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 The value of void?
Pranav, I think VOID is the type of entity that one shouldn't really do much with it except for voidP() tests or maybe direct comparisons to VOID. I only use value() to reconstruct objects and lists, but I use an object deconstructor/reconstructor object to do it. This explicitly handles all data types, including 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!]
Re: lingo-l The value of void?
On Tuesday, Apr 1, 2003, at 04:25 America/Chicago, [EMAIL PROTECTED] wrote: Will someone please decide once and for all what value(void) will return? I've got three different results, all on the same machine. http://www.geocities.com/pranav_negandhi/freaky_chakra_1.jpg That first item is not the value of void; it is the value of an empty string. When you do a value call on a string Director tries to coerce it to a numeric value (and, as you've surely noted, will even do arithmetic operations if you want it to as with 'put value 3 * 4'). So in this case the value of is equal to zero, but it is not void. The second one: http://www.geocities.com/pranav_negandhi/freaky_chakra_2.jpg Is truly odd and should not have happened that way. It would be nice if there were some steps to reproduce this one -- any chance you've had this happen with consistency? The third: http://www.geocities.com/pranav_negandhi/freaky_chakra_3.jpg is consistent with the first. This email is a natural product. The slight variations in spelling and grammar enhance its individual character and beauty and are in no way considered to be flaws or defects. That's clever! Warren Ockrassa | consulting | programming | [EMAIL PROTECTED] nightwares LLC | http://www.nightwares.com/ Developer | Structor, a presentation development/programming tool Info and demo | http://www.nightwares.com/structor/ 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 The value of void?
- Original Message - From: [EMAIL PROTECTED] Will someone please decide once and for all what value(void) will return? I've got three different results, all on the same machine. For the rest of the list; anyone who can't see the JPEGs, the question should have been what is the value of EMPTY?. The problem in the screenshots has nothing to do with value(VOID), which AFAIK always returns VOID. Also, there are only two different results shown. These are as follows: -- Test 1: put value( ) -- Void -- Test 2: put value( ) -- 0 Smells like BUG to me. I tried a test movie that runs this line of code continuously. Before saving, it always returned VOID. After saving, it always returned 0. Anyone encountered anything similar, or got different results? FWIW, I don't try to rely to much on anything that is returned by value(), but it would still be nice to have a conclusive idea of what it returns for empty strings and pure whitespace strings, under what circumstances. - Robert [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 The value of void?
-- Test 1: put value( ) -- Void -- Test 2: put value( ) -- 0 Smells like BUG to me. Except that you can't see that the first one is option-space. The message was apparently written a few days ago, but perhaps this is a developing April Fools joke. [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 The value of void?
- Original Message - From: Colin Holgate [EMAIL PROTECTED] Except that you can't see that the first one is option-space. The message was apparently written a few days ago, but perhaps this is a developing April Fools joke. ??? My post was written yesterday in response to Pranav Tab's posts (also dated April 1). Neither myself nor Pranav are using Macs, so we don't have option keys, and even if we did, you'd be able to see *something* not just an empty string (I assume option+space produces an extended ASCII character that looks like a space) Note that there is *no* space in the string, it is an empty double-quotes . It's definitely a real bug, but it seems to be intermittent. I just tried to reproduce it again and this time I just get 0's, no VOID. It's weird. I have to say, it's not exactly a critical bug, but it's definitely not an April fools joke. It's now April the 2nd and 17 minutes, so if it were a joke I'd have to tell you - that's the law. I did manage to reproduce the problem here earlier though, so if Pranav is making it up, he's doing a really thorough job... - Robert [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 The value of void?
I did manage to reproduce the problem here earlier though, so if Pranav is making it up, he's doing a really thorough job... His jpgs looked like they had a space, and with value( ) or value(space), I would get 0, and value( ) (that was an option-space, which I assumed would be the same as an alt-space) would give me Void. That was trying it at home. If I try it here now, my PowerBook gives 0, but my G4 give Void, the difference being that my PowerBook is running MX and my G4 is running 8.5.1. So, it may not be an April Fools after all, but it would have been a good one. This doesn't explain why you get varying results, because it's unlikely that your Director is changing between being MX and being 8.5.1. [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 The value of void?
At 15:32 01.04.2003 -0500, you wrote: -- Test 1: put value( ) -- Void -- Test 2: put value( ) -- 0 Even subtle details may matter here. Therefore, the above notation has to be corrected. Pranav's example (http://www.geocities.com/pranav_negandhi/freaky_chakra_2.jpg) reads: -- Welcome to Director -- put value() -- Void Smells like BUG to me. Except that you can't see that the first one is option-space. The message was apparently written a few days ago, but perhaps this is a developing April Fools joke. Well Colin, your explanation doesn't convince me OR I don't understand it. Granted I don't really know what option-space might do precisely but I#m pretty sure it would do this in a macish context. ALT-space opens a (mostly useless) system menue on win boxes. And pranav defined his box thusly: PIII 128 MB WinNT 4 SP6 Director 8 (I did my tests on athlon TB 800, 768 MB, w2kSp2, d9.0) When I read your previous post I assumed opt-space would produce a non breaking space which is entered as alt-0160 on win. But where to insert it? In Pranav's notation there are only 2 possible places to insert an nbsp; (§) put§value(): put value() -- Void 0 OR put value()§: put value() -- 0 Void None of them explains the riddle. I tried another invisible char, hex 0: z = numtochar(0) put z -- put value(z) -- 0 All the other control chars show a black box, don't they? So, if you have steps to repro, please expand. OTOH, if this is a 0104-fake, pranav should say so. It's 0204 in India for half a day, already. 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!]
Re: lingo-l The value of void?
In Pranav's notation there are only 2 possible places to insert an nbsp; (§) I guess I imagined it then. The JPEG looks like there's something between the quotes, more of a than a . I can't exactly match the font or size, but screen shooting it and comparing what I can type still makes it seem like there's a gap, but not as wide as a regular space. [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 The value of void?
- Original Message - From: Daniel Plaenitz [EMAIL PROTECTED] Even subtle details may matter here. Therefore, the above notation has to be corrected. Pranav's example (http://www.geocities.com/pranav_negandhi/freaky_chakra_2.jpg) reads: -- Welcome to Director -- put value() -- Void Well, I don't think that's important. If you look at the way I reproduced Pranav's original results, I typed my own code into an exitFrame handler and ran it. It continually returned VOID. Then I saved it, closed it and opened it again, with *no changes* either to the movie, my version of Director, or my system - that time it gave 0's. I have not since been able to get it to return VOID, but the *exact same code* gave different results at different times with the exact same configuration. A bug is one thing, but an intermittent bug is somewhat more worrying - it suggests the bug is not related to the value function so much as the way the reference to the static string value is handled, which could have wider implications. Most likely what we are seeing is a problem in the reference table where two identical but separate strings are accidentally given the same reference, or two strings with the same reference are incorrectly believed to be two identical but separate strings. That could potentially lead to inexplicable crashes that cannot be reproduced easily, as well as bugs like the one we are seeing. I can't think of anything else that could cause it, other than code with something really stupid in it, like: if random(100)2 then return silly result I don't think that's likely though. One thing that may be important is whether or not your code is the first thing to ever refer to the static string . That can be the difference between a reference to an existing string, or the creation of a new one. Because the value is static, there is nothing to say that Director is creating a new string each time, it may simply be recycling references, which is where the sort of bug I suspect may be causing this could creep in. I suspect that saving the movies sorted out these static references, which produced the differing results that I saw. I'm going to try reproducing the result again later after a cold boot to see if that makes a difference. There may be things hanging around in memory that make a difference. - Robert [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 The value of void?
- Original Message - From: Colin Holgate [EMAIL PROTECTED] I guess I imagined it then. The JPEG looks like there's something between the quotes, more of a than a . I can't exactly match the font or size, but screen shooting it and comparing what I can type still makes it seem like there's a gap, but not as wide as a regular space. Try setting the font to Courier New which is the font for the message window on the PC. I don't know what it is on the Mac, but the reason for the extra space is that Courier is fixed-width, and a is somewhat thinner than an M. It didn't even look odd to me, so I can only assume the font is totally different on your system. Incidentally, one of the reasons we all generally use fixed-width fonts for code is that you can easily tell that there is no space. Simply look at the characters immediately above the quotes and you will see that there are exactly two in the same horizontal space. Since all the characters are vertically aligned in a grid-like fashion, there cannot be an extra character between the quotes, or the quotes would span the width of 3 characters. - Robert [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 The value of void?
In an expression, though, Void is considered to be equivalent of 0. In my experience, not consistently. I spent a couple days last year tracking down a bug caused by a difference in the way Director on Windows and Mac treat Void. There was a boolean compare, something like: if someCondition then yada yada end if In some cases, someCondition could be Void. On the Mac, that boolean evaluated to FALSE. On Windows, it evaluated to TRUE. Void is Void. It's best to check for voidP, because you can't count on Director treating void as 0 or as false. 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 The value of void?
Try setting the font to Courier New which is the font for the message window on the PC. I did try that one. On the Mac we often use Monaco, which is also monospaced, and has the advantages you suggest that Courier has, but also it's sans-serif, which can be a bit more readable on a screen. [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 The value of void?
At 02:03 02.04.2003 +0100, you wrote: - Original Message - From: Daniel Plaenitz [EMAIL PROTECTED] Even subtle details may matter here. Therefore, the above notation has to be corrected. Pranav's example (http://www.geocities.com/pranav_negandhi/freaky_chakra_2.jpg) reads: -- Welcome to Director -- put value() -- Void Well, I don't think that's important. May be important, may be not. Trying to follow Colin's hypothesis it did make a difference. And when hunting an arcane anomaly like this one it is good praxis to avoid any random effects / noise. If you look at the way I reproduced Pranav's original results, I typed my own code into an exitFrame handler and ran it. It continually returned VOID. Then I saved it, closed it and opened it again, with *no changes* either to the movie, my version of Director, or my system - that time it gave 0's. I have not since been able to get it to return VOID, but the *exact same code* gave different results at different times with the exact same configuration. the *exact same code* is only what you see. I have had at least one case where directors symbol table was influenced by snippets of code that had been *deleted* but *still* were part of the .dir file. Invisible from within director. Visible as a string when examining the .dir with a hex editor. Valid in defining if symbol(Paul) would return #paul or #Paul. So, yes, I believe there are monsters and mysteries down there, including features with 6 legs. Up to now it is pranav and you who saw the beast and it might help if any of you could post the file which did it. Even if it doesn't show the effect any more, just to define a common basis. colin: the jpg looks like vanilla Courier to me. 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!]
RE: lingo-l The value of void?
A bug is one thing, but an intermittent bug is somewhat more worrying - it suggests the bug is not related to the value function so much as the way the reference to the static string value is handled, which could have wider implications. I think it has more to do with trying to use a void for anything useful. There have been long, sometimes acrimonious, threads about this. The bottom line is, don't count on a void or an empty string evaluating to anything meaningful. You can't count on it. It's much safer to do if not voidP(something) then... or if someString.length 0 then ... You'll save some bug-fixing time. Down on the machine level, there is a difference between void and zero. In C, for example, you can reference the 0th element of an array, but if the pointer is void, it doesn't point at any element. 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 The value of void?
- Original Message - From: Kerry Thompson [EMAIL PROTECTED] In some cases, someCondition could be Void. On the Mac, that boolean evaluated to FALSE. On Windows, it evaluated to TRUE. Are you sure it was always evaluating to VOID? Perhaps the problem was that it was evaluating to something else because of some function or whatever that gives a different result on each platform. Generally, using the = operator: 0 = 0.0 = VOID All of theese are different types, but each has a value that is considered equal to zero. That said, it's always a good idea to make sure your expressions actually evaluate to booleans, rather than using any shorthand, which I normally do like so: -- old if( someCondition ) then ... -- new if( someCondition false ) then ... This way, VOID, 0 and false will all evaluate as false, and everything else will evaluate to true, which is the expected behaviour if you are used to C/JavaScript, etc. Since Lingo isn't too clever about handling non-booleans in expressions, you will get a script error if the type is anything other than a float, integer, or VOID, even though logically any such thing should simply evaluate as true. The only problem with this is that most people would expect to evaluate as false, but it doesn't. What is also a shame is that Lingo doesn't have an equivalent to the === operator for exactly equal and !== for not-exactly-equal. These are found in PHP and a few other loosely-typed scripting languages and allow you to do type-safe comparsions. Mind you, you can get the same effect in lingo with a couple of simple functions: on eq( a, b ) if( ilk( a, ilk( b ) ) ) then return a = b else return false end if end on ne( a, b ) if( ilk( a, ilk( b ) ) ) then return a b else return true end if end This way, eq( 0, 0 ) will return 1, but eq( 1, 1.0 ) will return 0, eq( 0, VOID ) will return 0, etc. - Robert [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 The value of void?
- Original Message - From: Kerry Thompson [EMAIL PROTECTED] I think it has more to do with trying to use a void for anything useful. There have been long, sometimes acrimonious, threads about this. You miss the point here. If the value returned is sometimes VOID and sometimes 0, then if you do: if( voidP( result ) ) then -- do something else if( result = 0 ) then -- do something else end if Then you will get different results depending on the apparently random output from this function with a single known input. That's not good from an engineering POV. - Robert [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 The value of void?
- Original Message - From: Daniel Plaenitz [EMAIL PROTECTED] the *exact same code* is only what you see. I have had at least one case where directors symbol table was influenced by snippets of code that had been *deleted* but *still* were part of the .dir file. Invisible from within director. Visible as a string when examining the .dir with a hex editor. Valid in defining if symbol(Paul) would return #paul or #Paul. Yes, that's a known issue. Director always saves the symbol table and does not delete obsolete entries. The point in this case is that it was not changed: only saved, closed and reopened. I fully expect that there may have been changes to the internal static references (no symbols involved though) due to saving, but there have been no instances of stuff being added and then deleted. I simply created the test movie from scratch, although I have not since been able to reproduce the results, even after cold booting a couple of times. What I suspect is going on (and this is all conjecture based on the way other languages such as C++ work) is that static strings are normally stored in a resource area that is similar in many respects to the symbols table. So when you see in code, it might as well be a symbol called #, because it refers to a single chunk of memory set aside for each occurance of that static string. There is generally only one copy of each identical string to save space in the .exe file. So, you might have two bits of code with the static string Hello, but unless you actually modify one of them, they will both point to the same physical memory location. What may be happening is that these references are getting mixed up and the value function is internally comparing the wrong string references. FWIW, the only thing I have in my movie is an unnamed frame-loop script containing: on exitFrame me a = value() put a go to the frame end Rather than post the movie, it might be better if people try creating their own from scratch, as my saved movie is consistently outputting 0's now. - Robert [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 The value of void?
Hi List, Using Win 98, Dir 8 on exitFrame me put value() end Give me just -- 0 Its same in message window and after saving and run from the on exitframe handler. I think its saying that the VALUE of the command value() is nothing or simply zero(0). Do you say this!!! Regs, Biju George __ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com [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 The value of void?
You miss the point here. If the value returned is sometimes VOID and sometimes 0, then if you do: if( voidP( result ) ) then -- do something else if( result = 0 ) then -- do something else end if Then you will get different results depending on the apparently random output from this function with a single known input. That's not good from an engineering POV. Ah, but you will get consistent results with your code. You're testing for void first, just like I found I needed to do. That's the whole point. Void is, by definition, undefined--nothing. Not zero, not false. Good coding practice is to check to make sure the variable is initialized (not being initialized is the most common reason for a void return). I agree, maybe MM could have handled it in their code better, and given us consistent returns. OTOH, they have provided us with a workaround. Check for voidP and everybody's happy. 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 The value of void?
Are you sure it was always evaluating to VOID? Positive. The cause of the bug was a boolean with a void value evaluating to false on the Mac and true on Windows. Documented, submitted to Macromedia, rated NAB (not a bug). Chris Nuuja weighed in on it, too. Actually, it's not a bug, because void is NOT 0. Zero is a value, while void is the absence of a value. In the code that started this thread, we were checking the value of an empty string. There could be a problem there if it sometimes returns 0 and sometimes void. The solution is to check to make sure the string isn't 0 length. Uninitialized variables are the source of many, many bugs. 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 The value of void?
Firstly, I made a mistake with the subject line. It should've read the value of EMPTY. Second, this is not a fake. I've spent a maddening day and a half last month trying to figure out why my code would work one day and fail the next (usually in front of the management). I was using value to convert user input to numbers. A small test in the message window had returned value() as 0. Which is why I had gone and implemented it in my modules. I guess I'll follow Kerry's advice and use the length() function to check my conditions. BTW, can someone explain what Director's symbol table does? I tried talking to one of our Java programmers who brought up an analogy of Java's hash table. Is it something of similar nature? Is it built at runtime, or is it predefined? Regards, Pranav Negandhi This email is a natural product. The slight variations in spelling and grammar enhance its individual character and beauty and are in no way considered to be flaws or defects. [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 The value of void?
colin: the jpg looks like vanilla Courier to me. Ah, that's where I must have been going wrong. I tried Courier, and Courier New, but didn't try vanilla Courier. Is that Courier with a cream forecolor? [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 The value of void?
snip colin: the jpg looks like vanilla Courier to me. Ah, that's where I must have been going wrong. I tried Courier, and Courier New, but didn't try vanilla Courier. Is that Courier with a cream forecolor? snip You also get hot chocolate sauce as embellishments. All we need is a few nuts now. Regards, Pranav Negandhi [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 The value of void?
Will someone please decide once and for all what value(void) will return? I've got three different results, all on the same machine. http://www.geocities.com/pranav_negandhi/freaky_chakra_1.jpg http://www.geocities.com/pranav_negandhi/freaky_chakra_2.jpg http://www.geocities.com/pranav_negandhi/freaky_chakra_3.jpg PIII 128 MB WinNT 4 SP6 Director 8 Regards, Pranav Negandhi This email is a natural product. The slight variations in spelling and grammar enhance its individual character and beauty and are in no way considered to be flaws or defects. [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!]