How will global perlish variables disappear?

G

gabriele renzi

Hi gurus and nubys,

matz said more than once that the perlish global variables like
$/ or $: are going away in future releases.

I wonder if is there already a decision, what they will become?
I mean, it's easy to think that $DEFAULT_INPUT may become a class
variable of IO but what about $1..$n or $: ?

More, would it be possible to have some kind of backward compat via an
external module ?
 
R

Robert Klemme

gabriele renzi said:
Hi gurus and nubys,

No guru, just speculating...
matz said more than once that the perlish global variables like
$/ or $: are going away in future releases.

I wonder if is there already a decision, what they will become?
I mean, it's easy to think that $DEFAULT_INPUT may become a class
variable of IO but what about $1..$n or $: ?

For $1..$n there is MatchData which is IHMO a better abstraction. Btw,
I'd prefer to have a MatchData instance in situations like

"foooo".scan(/.(.)/) {|m| ... }

("m" is an Array here)

$: is IMHO a class constant of Kernel.
More, would it be possible to have some kind of backward compat via an
external module ?

Not if global variables are removed altogether. :)

robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top