Geeks Gone Wild!

july 28, 2006

This is an abbreviated conversation that JR and I had today.  All I know is that I'd rather be a zero than a null...I think...Anyways, this is what happens when geeks go wild... JR Conlin: I won't tell you about the four hour (yes four HOUR) debate I had to sit in on about whether NULL should behave like FALSE in if statements. Steve Kong: GAH Steve Kong: NULL should not behave like FALSE in an if statement, right? JR Conlin: Well, the guy and company I worked for said it should. Steve Kong: it shouldn't tho Steve Kong: that's why there are functions to test for NULL, which return true or false? JR Conlin: so it should behave as true? Steve Kong: oh, i see what you're saying JR Conlin: see, that was our point. JR Conlin: we agreed that in pure purpose false !== null, but for comparison sakes false == null. JR Conlin: the other camp said that null == !null should throw an exception. JR Conlin: yep, so in pure boolean equivalence false == 0 == null. JR Conlin: false !== 0 the same way that null !== false. Steve Kong: i thought if a var had something in it, it would not be null JR Conlin: yep. JR Conlin: yeah, as you can see, there is enough detail for folks to actually argue for four hours. JR Conlin: Fundimentally, though, the solution to it is actually quite simple. JR Conlin: thus: === and !== JR Conlin: for most casual purposes, null == false == 0 is fine for what folks want to do. JR Conlin: Hell, in some cases, null == false == '' == 0 == array() are all what folks mean. JR Conlin: if you absolutely want to check values, that's when you use ===. JR Conlin: Well, if it's any help, imagine me sounding like the nerd professor on the Simpsons. Steve Kong: wait wait Steve Kong: NULL is the absense of everything Steve Kong: 0 is the same ? Steve Kong: but 0 is not equal to NULL? JR Conlin: Nope. JR Conlin: Think of it as forms of a vacuum. JR Conlin: You can have an empty room. JR Conlin: or you can have one filled with atmosphere only. Steve Kong: but ... JR Conlin: one is technically not empty, but still void of what you want. Steve Kong: that relies on what you're determining to count Steve Kong: symantics JR Conlin: yeppers. that's the key. JR Conlin: Null is the absense of assigned value. JR Conlin: 0 is the absense of positive or negative numeric value Steve Kong: but if we think of it in a real world... Steve Kong: if we talk about brownies Steve Kong: 0 means i have no more brownies Steve Kong: and Steve Kong: null means brownies never existed EVER and i can't even count 'em? JR Conlin: yep. JR Conlin: that's it. Steve Kong: ok JR Conlin: who laced the brownies? Steve Kong: sigh JR Conlin: Logic is a tweeting bird, chirping in a meadow... Steve Kong: existentialism Steve Kong: is jr really there? Steve Kong: he has been defined JR Conlin: Oh hell no. Descartes proved that.


<< back || ultramookie >>