[#1816] Ruby 1.5.3 under Tru64 (Alpha)? — Clemens Hintze <clemens.hintze@...>

Hi all,

17 messages 2000/03/14

[#1989] English Ruby/Gtk Tutorial? — schneik@...

18 messages 2000/03/17

[#2241] setter() for local variables — ts <decoux@...>

18 messages 2000/03/29

[ruby-talk:02279] Ruby Lang Ref Manual 1.4 Question: $= & is nil not false?

From: schneik@...
Date: 2000-03-30 20:49:18 UTC
List: ruby-talk #2279

Hi,

In the Variables section, we have (nil):

============================================
$=

     The flag for case insensitive, nil by default. (Mnemonic: = is for
comparison.)
============================================

In the String section, we have ((not) false):

============================================
self == other
     self > other
     self >= other
     self < other
     self <= other

          String comparison. If the value of the variable $= is not false,
comparison done by case-insensitive.
============================================

I just want to be sure that this is the same as saying "If the value ... is
not nil, ....".

==== new question ====

I have a more general question about the use of global variables such as
$=, $/, $\, and the like: Is there any way that you can protect yourself
from your own code or from other library/extension classes/modules that
might change one of these and not reset it (due to simple forgetfulness, or
some sort of exception, and so on)?

It might be nice to have standard but automagically localized versions of
these variables, perhaps $$=, $$/, $$\, and so on, that would locally
over-ride their global counterparts.  Perhaps then Ruby strict compile mode
could prohibit you from changing the global control variables, but allow
the use of the localized control variables. (I distinguish $ "control
variables" from $1, $&, and other sorts of $ "return value" variables.)

Conrad Schneiker
(This note is unofficial and subject to improvement without notice.)


In This Thread

Prev Next