Paul Gilmartin wrote:
On Mon, 10 Mar 2008 19:16:26 +0000, Ted MacNEIL wrote:
They are not going to change after 30 years because that would break too many 
things.

That may not be logical, but that's how it works.

It's the rules.  We gotta deal with it.  I recently had the
complementary problem coding an awk script while my mind was
operating in Rexx mode.  I had "0" in an environment variable
and "0" behaves differently from 0 in some contexts.

In this case, I dealt with it by changing "if ( SWITCH )" to
"if ( SWITCH + 0 )"  to force a numeric test.

Cowlishaw tried to implement the principle of least astonishment
by designing so that if two things look the same, they should behave the same. Alas, a collateral consequence is that if two
things look different, they may regardless behave the same.

Do I understand correctly that in Java:

    2 + "2" is 4, but

    "2" + 2 is "22"?  The "+" operator is not commutative.

-- gil

Not true; both produce "22":

    System.out.println("In main");
    System.out.println("2 + quoted 2 = " + (2 + "2"));
    System.out.println("quoted 2 + 2 = " + ("2" + 2));
    System.out.println("Leaving main");

yields:

In main
2 + quoted 2 = 22
quoted 2 + 2 = 22
Leaving main



Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-393-8716
http://www.trainersfriend.com

  z/OS Application development made easier
    * Our classes include
       + How things work
       + Programming examples with realistic applications
       + Starter / skeleton code
       + Complete working programs
       + Useful utilities and subroutines
       + Tips and techniques

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to