Aleksi Niemel<aleksi.niemela / cinnober.com> writes:

> This means that you can't write
> 
> " now's   the time".split
>
> because if you happen to say 'require "foo"' and foo happens to
> change $; (maybe even indirectly saying eval for something coming
> from file (really bad :)) you're soon out of luck. So to be on the
> safe side you have to give up the common idiom and write split
> everytime by specifying the whitespace.

Actually, it's even worse than that. With $;, the person invoking the
prohram can override it with the -F option, so you're not safe just
because you don't include any modules.

How about making any assignment to one of these globals-with-a-
side-effect generate a warning if -w was in effect. That way you'd at
least know that it was happening.


     % ruby -w -F! dave
     Warning: changing $; may affect this program's behavior

If you have a legitimate reason for doing it, you can turn warnings
off in the code while you make the assignment. At least that extra
effort would make you think about the potential consequences.


Regards


Dave