Ooo. This is one that I can answer.
In most computer language syntax, the statement @X = Y assigns the
value Y to variable @X.
In some comptuer languages, the *expression* ( @X == Y ) compares @X
and Y for equality (does @X contain the value Y ?) and returns a
result of true or false.
In some
Giles suggestion, to reverse the order of the terms, is a good one,
because it prevents a typo from compiling without error and
accidentally causing an assignment at run-time, and instead generates
a compile-time error, pointing out the typo!
yeah that's exactly it. these bugs happen a lot.
// World's last bug
if (red_button_pressed = 1)
launch_missile();
I thought that was pretty funny ^_^
.. for all 7 of us who understood it!
-- Owen
Owen Densmore http://backspaces.net
FRIAM Applied Complexity Group
*** tomorrow immediately following Kim Sorvig's 10:30a talk ***
** NOTE location of James Little Theatre **
SPEAKER:
Rose Tocke, Director Community Dynamics/Biomimicry Guild
TITLE:
Designs of Nature: Introduction to Biomimicry Keynote
TIME: Thurs Oct 26, 11:30a-12:30p
LOCATION:
I was about to say: can someone translate this joke into English? (It
looks funny, but...)
- Original Message -
From: Owen Densmore [EMAIL PROTECTED]
To: The Friday Morning Applied Complexity Coffee Group friam@redfish.com
Sent: Wednesday, October 25, 2006 8:11 PM
Subject: Re: [FRIAM]
In some languages, the assignment operator, =, not only assigns a
value to a variable, it also returns that value as the expression's
value itself. This is to allow things like
a=b=c=42;
So in the expression
red_button_pressed = 1
The value 1 is assigned to the variable
Owen Densmore wrote:
So the *extremely* common bug
of using = rather than == causes entirely unexpected consequences ..
launching a missile.
I expect to see both in many circumstances.
For example, when opening a file to read that is absent or to write, and
write permission is
// World's last bug
if (red_button_pressed = 1)
launch_missile();
I thought that was pretty funny ^_^
.. for all 7 of us who understood it!
-- Owen
The odd thing is it made me laugh a lot, as if I understood the joke,
even though I have no idea what it means! (except for
OK, thanks Doug and Owen, I'm
laughing.
And I'm also noting that Cormac McCarthy
(who has been hanging out at SFI lately, and even thanked the Institute in his
last book) has a new one about a post-nuclear-apocalyptic society ("The
Road"). Could this be the result of programming error? Or