On Jan 22, S. Dale Morrey wrote:
> Consider for a moment the hypothetical bit of code.
>
> if(pStart->nVersion = 2){do something new}else{do the old thing}
>
> if nVersion was defined as a constant, then this would throw a compile
> error the first time you built it. But with the current code the "do
> something new" block would ALWAYS run, and the "do the old thing" block
> would NEVER run. Thus, you might never know there was a problem until
> existing clients started breaking.
I once used a language with three operators:
left := right assigned,
left == right compared,
left = right guessed.
The guess was generally correct; when used as a statement, it would
assign; when used as an expression, it would compare. Even
daisy-chained assignments worked properly. But when you really wanted
to assign in the condition of a while loop, or assign the result of a
comparison, you had the option to use the more explicit operators.
Why don't more languages do that?
- Eric
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/