2009/4/24 Thomas Hafner <thomas / faun.hafner.nl.eu.org>:
> Robert Klemme <shortcutter / googlemail.com> wrote/schrieb <75bjgbF17nqkvU1 / mid.individual.net>:
>
>> On 23.04.2009 16:50, Thomas Hafner wrote:
>>> Joel VanderWerf <vjoel / path.berkeley.edu> wrote/schrieb <49EF9F29.2060704 / path.berkeley.edu>:
>>>
>>>> Can't you use local variables to do the same thing?
>>>
>>> I can. That's it, thanks!
>>
>> Now you made me curious: why?
>
> I guess that using local variables is not exactly the same thing like
> class constants,

Of course it's not the same, but it always depends on the use case.

> but it's close enough that I don't (yet) notice the
> difference when writing Ruby programs which load that startup file:

Does this mean you switched to local variables?

> Neither are the variables from outside visible to the loaded startup
> file, nor are local variables of the startup file visible from
> outside. (That wasn't the case for uppercase names (constants!), and
> so I had to enclose them in a dummy class - or whatever - do you know
> a simpler solution to hide constants, BTW?)

The question is: why do you need constants if you want to hide them?
Now it is even less clear to me what you want.  All I've understood is
that you want to require a file (even if it's autorequired) and make
sure that particular information does not leak. OTOH I am sure you
want some information to leak so why don't you use constants for the
things (classes, modules) that need to be known outside and use local
variables for the rest?

Cheers

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/