develooper Front page | perl.perl5.porters | Postings from August 2001

Re: [PATCH 2 of 3] $] is deprecated - EXTERMINATE, EXTERMINATE, EXTERMINATE

Thread Previous | Thread Next
From:
John Peacock
Date:
August 23, 2001 09:37
Subject:
Re: [PATCH 2 of 3] $] is deprecated - EXTERMINATE, EXTERMINATE, EXTERMINATE
Message ID:
3B852FE2.297C3201@rowman.com
Rafael Garcia-Suarez wrote:
> 
> John Peacock wrote:
> >
> > If it is used as a version string, it will be upgraded to be a version
> > string (if the tokenizer didn't already catch it).  So
> >
> >       $VERSION = "5.6.1";

This is a PV containing "5.6.1" until Exporter needs to use it in a 
version comparison and calls UNIVERSAL::VERSION.  From there it is 
passed to new_vstring() and returns as "\5\6\1" for comparison
purposes.  
Currently, I actually upgrade the SV containing $VERSION automatically; 
I could easily just make a copy for comparison purposes.

> > and   $VERSION = 5.6.1;

During tokenization, scan_num would start to work on this thinking
it was a float, then dispatch it to the 'v' handling section where it
gets passed to new_vstring() and gets coded the same way.

> >
> > would both be compared as "\5\6\1" automagically.
> 
> How would you achieve this ?

Those are the easy cases.  The ones I am stuck on are 

	$VERSION = 5.6;       # tokenizer makes this an NV
	$VERSION = 5.004_53;  # tokenizer makes this an NV

> And this seems a little bit too DWIMmy: I expect "5.6.1" to be
> equivalent to v53.46.54.46.49. At least on ASCII machines.

Why would you imagine it would do that?  Until now, "5.6.1" would be
compared as a string without conversion.  Only bareword numbers with
a 'v' or two decimals are currently converted to v-strings.  DWIM 
would suggest that I meant to type:

	$VERSION = 5.6.1;    # implied 'v' string

thanks

John

--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4720 Boston Way
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747

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