develooper Front page | perl.perl5.porters | Postings from May 2003

Re: Should we deprecate $; ?

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
May 14, 2003 00:04
Subject:
Re: Should we deprecate $; ?
Message ID:
20030514090119.3929ac82.rgarciasuarez@free.fr
Michael G Schwern <schwern@pobox.com> wrote:
> On Tue, May 13, 2003 at 11:56:50PM +0200, Rafael Garcia-Suarez wrote:
> > $; is the subscript separator for multidimensional array emulation
> > (as says perlvar).  Basically it works like this :
> > 
> >     $ perl -MO=Deparse -e '$x{1,2}'
> >     $x{join $;, 1, 2};
> > 
> > In our Unicode and UTF8 world, it's becoming more and more unsafe to use
> > that kind of hack, esp. when better alternative solutions are available.

Let me apologize for that FUD.
I forgot about the UTF8 flag on hash keys.

> > I therefore suggest to add to 5.9 a deprecation warning
> > 
> >     "Use of multidimensional array emulation is deprecated"
> > 
> > for any use of the implicit join($;,...).
> 
> FWIW, Tie::Math makes good use of it because writing tied, multi-dimensional
> data structures is a pain in the ass.  Its easier to handle:  $tied{1,2,3} 
> than $tied{1}{2}{3}.

However, there is no real significant advantage over $tied{"$a,$b,$c"}.
At least when the number of dimensions is constant (as in every good
universe ;-)

> Its also smaller and faster than working with multidimensional data
> structures.
> 
> As I'm more concerned about speed, size and ties than Unicode, I'd say leave
> it.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About