[897] in java-interest

home help back first fref pref prev next nref lref last post

Re: Language spec syntax ambiguities

daemon@ATHENA.MIT.EDU (Gary Funck)
Mon Aug 14 14:31:39 1995

Date: Mon, 14 Aug 95 07:27:43 -0700
From: gary@Intrepid.COM (Gary Funck)
To: java-interest@java.sun.com


G'day,

| 
| This is more or less what I'm looking for.  However, I don't believe
| this is quite right for a couple of reasons.  First, you can also say
| "super(x,y,z)" and "this(x,y,z)" inside a constructor (I suppose by my
| argument above we should special case constructor bodies, but ...).
| Also, I'd argue for something lower down the precidence chain than
| expression since this allows "2+2.foo = 5;" which brings us back to the
| same issue.  Finally, this introduces another ambiguity.  "a+b" is a
| valid expression so does "a+b.c = 5" mean "(a+b).c = 5" here (that's
| the parse tree you get)?

If the Java language designers open up the Pandora's box of
operator-overloading, then will

   (a+b).c = 5

be valid?  (if, for example,"+" returns a reference to a class object.)

Likewise, I assume

    ((myclass)2+2).foo = 5

would become legit as well, since "myclass" might define "+" on objects
of 'myobj' added to integers.

--
| Gary Funck  		     gary@intrepid.com
| Intrepid Technology Inc., Mountain View CA (415) 964-8135
| "Everybody has plans, until they get hit."  -- Mike Tyson


-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post