On 17/04/2008, at 2:46 AM, James Lampert wrote:
Personally, I've always felt that both Niklaus Wirth and Dennis Ritchie
were full of equine scat on that one: if a language as advanced as PL/I,
and one as simple as all but the most rudimentary dialects of BASIC, can
both recognize whether "=" was being used in an assignment context or an
equality context, then why SHOULD there be separate operators, at least
for general use?

Can't recall about Pascal but C requires two operators because it allows assignment IN an equality context (i.e., if ( a = b) which doesn't behave in the obvious manner). The only reason C can do this is because it also has the behaviour of 0 is false and anything else is true. Any language that allows both assignment and equality in the same statement requires two operators in order to distinguish between both operations.

I doubt Pascal allowed assignment in a conditional expression and I think it had two operators simply to "force clarity of intent" on the programmer.

However, I'm in agreement with you about using separate operators for assignment and equivalence. Interestingly Rexx uses doubled operators for 'strict' comparisons. This to me makes sense. Comparing two values (ignoring leading zeroes, and leading or trailing blanks) is a different operation from comparing two values EXACTLY. Different operations require different operators.

There are certain conditions in systems coding where being able to assign a value in a conditional statement MAY result in code efficiencies but these are in the minority--and often only in the mind of the coder. Seems pointless to me to provide language support for a construct that:
a) is fraught with peril
b) is considered poor practice
c) is rarely used

So says Simon currently involved in getting C code that compiled cleanly under the 440 C compiler to compile under the new PASE C/C++ compiler. I thought the old C compiler was strict but the new one seems over the top. The dreaded "CZM0280-Function argument assignment not allowed" error. It's not my code by the way--all MY stuff compiles cleanly under both compilers--but more 'open-source' crap that follows both old-fashioned and poor coding practices "for portability reasons". Forgive me for appearing cantankerous ...

Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists

http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.