[3169] in java-interest

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

Re: Q on static method reference to class

daemon@ATHENA.MIT.EDU (David Forster)
Thu Nov 2 03:20:15 1995

Date: Thu, 2 Nov 1995 00:55:24 -0500
To: Bob Beck <rbk@ibeam.jf.intel.com>
From: mentor@io.org (David Forster)
Cc: Thomas.Ball@Eng.Sun.COM (Thomas Ball), rbk@ibeam.jf.intel.com,
        java-interest@java.Eng.Sun.COM

At 18:02 31/10/95, Bob Beck wrote:
>At 05:48 PM 10/31/95 -0800, Thomas Ball wrote:
>>>  Suppose I want to refer to the class in a static method [...]
>>
>>There is no easy way to divine that name from inside a static method
>>(unless you do the above), but then the class is already defined.
>
>There is a class object, but it doesn't seem wired into the method
>resolution process quite right.  Since an instance method can say getClass()
>to get a reference to the class, why can't a class method do something to
>get it?  Intuitively, "this" in a class method would refer to the class.

 Ack! Not "this"!  I've written too much code at 3 AM which assumes the
wrong things, like being in an instance method instead of a static method.
"this" used in a static method is more likely to be caught unambiguously if
we don't force it to do double duty. (Not to mention type weirdness.)


Cheers,
  David Forster                <br><a href="http://www.io.org/~mentor">
  Mentor Software Solutions    </a><br>
  +1 905 832 4837              <br>


-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

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