29 Nov 2004
I must suffer from some rare and highly specific form of dyslexia. Even though I know exactly what the difference is, I keep using = when I mean ==. I reckon that about 80% of the problems I've had while writing Ruby have come from using the assignment operator when I really want a comparator.
I need to tattoo = != == on the back of my hand.
2
Well, printing it in your retinia would even help more3
Don't worry, I do the same in PHP, although once you've spent six hours debugging something only to realise that it was meant to be == instead of = then you do tend to remember it afterwards. It's still nice though when you can pick up someone else who has done the same thing - I did it recently on a forum where everyone else had gone all intricate and complex to sort out a problem, then muggins here piped up "use == instead of =" and you could hear the sound of slapped foreheads and "doh!" from around the country...4
You know when you listen to 'surround sound' and the noise goes right over your head? That's how these posts are to me. Yet I feel strangely drawn back each day - just to see if I ever understand one... {8¬)5
I'm almost with Mr.D on this one... But you HAVE got me thinking about the ultimate geek tattoo. Hmmmm6
Ultimate (Unix) geek tattoo: /dev/tattoo7
steve: That's a good tip! But then I'd have to relearn which side the constant goes on... David Smith: [shudders] I'm glad I don't have to deal with this kind of thing. iiome: For some reason, I don't suffer the same problem with concatenation. Lyle: Nice to know I'm not the only one8
I just had to approve my own comment, because it had 2 links in it9
You captivated me with Balti, and music, guaranteeing that I'll keep returning. Of course. I have NO idea what the heck you're talking about when you geek out, but I love it anyway--I think it's the accent!:)by Tony Iovino @ 30/11/2004 10:12 pm • Permalink
10
The way I do this is a simple, stupid mnemonic device: one = means 'is' because 'is' is one syllable and there is only one =, and two == is 'equals' because 'equals' has two syllables and there are two ==. so saying 'foo is PI' will return true as long as foo is not a constant, and saying 'foo equals PI' only returns true if foo is actually 3.1415.... Works for me, at any rate... nice job on the gtd app btw11
I sympathise entirely having been inflicted with a frighteningly similar strain of dyslexia. I feel this qualifies me to offer three little words... Can you guess what they are?12
Tony Iovino: I have no idea what I'm on about either, sometimes. Matt: Nice mnemonic. However, I can remember the difference fine, I just don't seem able to spot it when I make a mistake! Jann: Err, no... Go on, what are they?13
Yeah, = and == are stupid IMO. I would prefer assignements to be := (like Pascal and Smalltalk) and equality to be =, that'd be simpler, and less errors could arise because you didn't double the equal sign.by Vincent Foley @ 02/12/2004 5:12 am • Permalink
14
Get out more. :o)15
Vincent Foley: Ah, Pascal... I remember those days. Jann: Hehe :-D We need someone to monitor the level of geekisms, and ensure that they are within safe operating parameters. I hereby appoint you Geekism Safety Levels Inspector (motto: "Keeping you safe from technobabble since 2004!").16
Can I just include management speak within that framework, just to make sure we're all singing from the same hymn sheet?17
Jann: ...and that we know what we're doing going forward? -----18
I was reading this post before I turned 18. On my 18th birthday I got inked. Here is what I got: /dev/tattoo I have you people to thank for it. Pictures, if you want. $ lollyby Hari Schelldon @ 03/04/2007 7:16 pm • Permalink
1
One of the few bits of coding standard that I've seen that I actually found worthwhile taking up is to always put the constant on the left So rather than writing if(x = SOME_CONSTANT) ... which compiles and is wrong, I put if(SOME_CONSTANT = x) which throws a wobbly when it tries to assign to the constant and reminds me that I meant if(SOME_CONSTANT == x) P.S. The fix for the WordPress glitch is working just fine.----- This is one reason I detest the idiom that NSEnumerator forces on programmers: NSEnumerator * e = [array objectEnumerator]; id obj; while(obj = [e nextObject]) { [obj doSomething]; } imo using = in a boolean expression like that should be avoided if at all possible, just to help avoid the confusion you mention. If if weren't for a = b = c; I wouldn't even mind making = not return a value. Casting to/from bools annoys me to; while(1){ bla(); } makes no sense to someone who doesn't know the underlying implementation of the type.by David Smith @ 29/11/2004 8:11 pm • Permalink