Re: Const in java

1999-10-15 Thread Brandon Anderson
On Fri, 15 Oct 1999, Robert Simmons wrote: > > - Original Message - > From: Gordon Keith <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Cc: Robert Simmons <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Wednesday, October 13,

Re: Const in java

1999-10-15 Thread Michael Emmel
> > > Such is the problem there are times where I dont want the user to be able > to alter a returned object's state. > Thats easy just add a lock variable that take the ( Caller) as a prameter to set. Or its not public. Check that on each method invoction which effects state. I'm not sure of

Re: Const in java

1999-10-15 Thread Robert Simmons
- Original Message - From: Gordon Keith <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: Robert Simmons <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, October 13, 1999 8:36 PM Subject: Re: Const in java > [EMAIL PROTECTED] wrote: > > > &

Re: Const in java

1999-10-14 Thread Michael Sinz
On Thu, 14 Oct 1999 09:26:32 -0500 (CDT), Alex M. wrote: >So there is no added benefit to declaring a parameter final other than to >allow access from inner classes within the method. Well, that is one benefit. But the other benefit is a code maintainance and readability issue. By saying that

Re: Const in java

1999-10-14 Thread Vartan Piroumian
OK, last one, and then maybe we should take this "offline" because it is not a Java linux question... A "final" parameter is REQUIRED by the compiler if the variable is referred to by an inner class. All local variables must be declared final when referred to by inner class definitions. This i

Re: Const in java

1999-10-14 Thread Alex M.
So there is no added benefit to declaring a parameter final other than to allow access from inner classes within the method. On Thu, 14 Oct 1999, Vartan Piroumian wrote: > Hi folks, > > All parameters are ALWAYS passed by value in Java. > > When the parameter being passed is an object referenc

Re: Const in java

1999-10-14 Thread Vartan Piroumian
Hi folks, All parameters are ALWAYS passed by value in Java. When the parameter being passed is an object reference it is the VALUE OF THE REFERENCE that is passed by value, not the object being referenced. This may seem like a moot distinction, but it is not. A method cannot destroy the ref

Re: Const in java

1999-10-13 Thread Gordon Keith
[EMAIL PROTECTED] wrote: > > On Wed, 13 Oct 1999, Robert Simmons wrote: > > > Since everything in java is passed by reference this becomes even more of an issue. > > Therefore can I do the following to achieve the desired safety ? > > Well, everything is not passed by reference in Java. I beli

Re: Const in java

1999-10-13 Thread Michael Emmel
[EMAIL PROTECTED] wrote: > On Wed, 13 Oct 1999, Robert Simmons wrote: > > > Since everything in java is passed by reference this becomes even more of an issue. > > Therefore can I do the following to achieve the desired safety ? > > Well, everything is not passed by reference in Java. I believe

Re: Const in java

1999-10-13 Thread Matt Welsh
Robert, Since most of your questions are general Java questions and have nothing to do with the Linux port of the JDK, can you please direct them elsewhere? The USENET group comp.lang.java.programmer is probably a good place to ask. Thank you, Matt Welsh, UC Berkeley "Robert Simmons" <[EMAIL P

Re: Const in java

1999-10-13 Thread jools enticknap
t Simmons" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Subject: Const in java >Date: Wed, 13 Oct 1999 15:54:26 -0600 > >I was always the real proponent of type and instance safety in c++. for >example. > >class Foo { > private BarClass _bar; > >

Re: Const in java

1999-10-13 Thread alx
On Wed, 13 Oct 1999, Robert Simmons wrote: > Since everything in java is passed by reference this becomes even more of an issue. > Therefore can I do the following to achieve the desired safety ? Well, everything is not passed by reference in Java. I believe primitives and immutable types are

Const in java

1999-10-13 Thread Robert Simmons
I was always the real proponent of type and instance safety in c++. for example.   class Foo {   private BarClass  _bar;     public const BarClass& getBar();   public setBar(const BarClass const &bar); }   This snippet guarantees that someone doesnt pull a getBar() then set the return resu