private variables 
Author Message
 private variables

dblack wrote
...

Quote:
> >  In this case where do you store class local variables (i.e. what you call
> >  private variables :-)) ?

> Whoops, I have reintroduced deprecated terminology into the discussion
> :-) And I probably can't answer your question very cogently.  But I

Regard yourself as a first time offender  - third strike and you will be
condemned to a life behind C++-bars (foos whatever;-).

/Christoph



Fri, 04 Mar 2005 23:02:33 GMT  
 private variables

d> Whoops, I have reintroduced deprecated terminology into the discussion
d> :-) And I probably can't answer your question very cogently.  But I
d> guess I'd store them wherever they'd be stored if they were named


 become a class local variable automatically (because it's stored with
 class local variable), no ?

Guy Decoux



Fri, 04 Mar 2005 23:09:38 GMT  
 private variables


Quote:
> Hi,

> In message "Re: private variables"

> |Well, will these localized/private variables make it into the next Ruby
> |release?  Because there were some previous objections regarding the single
> |leading underscore ("I have used leading underscore in my current instance
> |variables"), or regarding the symmetry ("It will not look balanced"), will
> |there be any vote on the format of the localized variables:
> |





> |
> |Or will Matz decide on this?


> balancing.  Those who care may put extra "__" after varriable names.

or being my repetitive self


This probably breaks no (non-obfuscating) existing
code and is quite distinct from regular instance (and
local) variables.

/Christoph

Ps.  I am very curious about your opinion on Dave's

   _block_local_variable_idea

(Sorry Dave, hopefully you won't be haunted by  ``the
ghosts that you called'';-).



Fri, 04 Mar 2005 23:15:37 GMT  
 private variables

Quote:
> -----Original Message-----

> Sent: Monday, September 16, 2002 10:46 AM
> To: ruby-talk ML
> Subject: Re: private variables

> Hi,

> In message "Re: private variables"
>     on 02/09/16, William Djaja Tjokroaminata

> |Well, will these localized/private variables make it into
> the next Ruby
> |release?  Because there were some previous objections regarding the
> |single leading underscore ("I have used leading underscore in my
> |current instance variables"), or regarding the symmetry ("It
> will not
> |look balanced"), will there be any vote on the format of the
> localized
> |variables:
> |





> |
> |Or will Matz decide on this?


> about the balancing.  Those who care may put extra "__" after
> varriable names.

>                                                    matz.



special constants like __FILE__, etc so it may yield less conflicts with
existing code bases.

-rich



Fri, 04 Mar 2005 23:27:01 GMT  
 private variables

uh-oh, looks like Ruby is headed the way of perl. can anyone say,
rubyisms?

--
tom sawyer, aka transami



Fri, 04 Mar 2005 23:30:08 GMT  
 private variables

Quote:

> Private methods and class-local instance variables are quite different.
> If you use a private method, you get an exception. If you try to use
> a class-local instance variable then you just use another variable,
> which could lead to obscure bugs.
> So I think punctuation (and it should be as short as possible)
> is a much better option.

If you try to use a class-local instance variable and it has not yet
been initialized, I would expect to see a warning when you run with ruby
-w, just like you get now with regular instance variables.

Paul



Sat, 05 Mar 2005 00:03:17 GMT  
 private variables
Hi --

Quote:

> David:

> Did you ever find out how far from the SEA airport
> to the conference center and hotel?

No....  Can I punt this to the Seattle crowd?  (Hey,
Seattle crowd, wake up -- it's 9:00 :-)  I'll try to
look it up if they don't respond quickly.

David

--
David Alan Black                      | Register for RubyConf 2002!


Web:  http://pirate.shu.edu/~blackdav | http://www.rubyconf.com



Sat, 05 Mar 2005 00:13:14 GMT  
 private variables
Hi --

Quote:

> or being my repetitive self


> This probably breaks no (non-obfuscating) existing
> code and is quite distinct from regular instance (and
> local) variables.

This also makes sense to me because it reads from left to

like "instance va... oh, did I forget to metion it was
private? ...riable".

David

--
David Alan Black                      | Register for RubyConf 2002!


Web:  http://pirate.shu.edu/~blackdav | http://www.rubyconf.com



Sat, 05 Mar 2005 00:14:07 GMT  
 private variables
Hi,

In message "Re: private variables"


|> balancing.  Those who care may put extra "__" after varriable names.
|
|or being my repetitive self
|

This will not break anything, but too ugly.

                                                        matz.



Sat, 05 Mar 2005 00:22:54 GMT  
 private variables

On Tue, 17 Sep 2002 01:21:39 +0900

Quote:

> Hi,

> In message "Re: private variables"


> |> balancing.  Those who care may put extra "__" after varriable names.
> |
> |or being my repetitive self
> |

> This will not break anything, but too ugly.


Are we dead set against "attr_private" ?

   class Foo
        attr_private :bar
   end

?


to be more desirable...this has been a long thread :->

----------------------------------------------------------------------
| Jim Hranicky, Senior SysAdmin                   UF/CISE Department |
| E314D CSE Building                            Phone (352) 392-1499 |

----------------------------------------------------------------------

"Given a choice between a complex, difficult-to-understand, disconcerting
 explanation and a simplistic, comforting one, many prefer simplistic
 comfort if it's remotely plausible, especially if it involves blaming
 someone else for their problems."
                                                -- Bob Lewis, _Infoworld_

  application_pgp-signature_part
< 1K Download


Sat, 05 Mar 2005 00:39:31 GMT  
 private variables

Quote:

> or being my repetitive self


> This probably breaks no (non-obfuscating) existing
> code and is quite distinct from regular instance (and
> local) variables.

<ironic>
What, you mean we can't use a single _ as a method name now?

def _(var)
  puts "Var is #{var}"
end


</ironic>

Why this works at all beats me :-)

--
(\[ Kent Dahl ]/)_    _~_    __[ http://www.stud.ntnu.no/~kentda/ ]___/~
 ))\_student_/((  \__d L b__/  NTNU - graduate engineering - 5. year  )
( \__\_?|?_/__/ ) _)Industrial economics and technological management(
 \____/_?_\____/ (____engineering.discipline_=_Computer::Technology___)



Sat, 05 Mar 2005 00:50:20 GMT  
 private variables
Hi,

In message "Re: private variables"

|Are we dead set against "attr_private" ?
|
|   class Foo
|       attr_private :bar
|   end
|
|?

I'm not going to choose attr_private (unless someone put some idea in
my brain), because

  a) we need static information about class local instance variable at
     compile time.  Dynamic attr_priate at run time is too late.

  b) if we choose attr_private (by making it a syntax), we need to
     search for declaration to distinguish whether a instance variable
     is class local or not.  I don't feel it's a Ruby Way (tm).

                                                        matz.



Sat, 05 Mar 2005 00:54:12 GMT  
 
 [ 88 post ]  Go to page: [1] [2] [3] [4] [5] [6]

 Relevant Pages 
 

 
Powered by phpBB® Forum Software