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 24, 2001 13:26
Subject:
Re: [PATCH 2 of 3] $] is deprecated - EXTERMINATE, EXTERMINATE, EXTERMINATE
Message ID:
3B86B848.D2C39CBC@rowman.com
Abigail wrote:
> 
> On Thu, Aug 23, 2001 at 12:31:30PM -0400, John Peacock wrote:
> > Rafael Garcia-Suarez wrote:
> > >
> > > 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?
> 
> Eh, because it currently does, and that behaviour is documented?
> 
>     $ perl -wle 'print "Yes" if "5.6.1" eq v53.46.54.46.49'
>     Yes
>     $

This whole thread is completely missing the point.  All I am trying 
to do is make version comparisons consistent.  Period, end of 
sentence.  I am not trying to change v-string behavior as currently 
documented.  I don't understand Unicode equality in the slightest, 
nor is it likely I will learn it before Perl6 comes out.

All I want to do is take anything that's USED as a version, 
upgrade it to v-string if it isn't already, and then use that vstring
when comparing versions (say in CPAN or Exporter).  What I envision
is that the following:

	$VERSION = v5.6.1;	# tokenized to v-string
	$VERSION = 5.6.1;	# ditto
	$VERSION = "5.6.1";	# upgraded for test
	$VERSION = 5.006_001;	# one I cannot handle just yet

all compare as the same version; but ONLY when compared as versions.
You can still do '$VERSION eq v53.46.54.46.49' since I have not done
anything to $VERSION.  I only converted it to a v-string when I was
testing it AS A VERSION.

Let's see how far that concept goes:

	$VERSION     = v20001102;
	$NEW_VERSION = v20010101;
 
	print "newer\n"
	    if $VERSION lt $NEW_VERSION; 

works fine.  But I am not even talking about DWIMming it that far;
The only code that will make use of my changes will be 
UNIVERSAL::VERSION (and Exporter, which will inherit from that (and
CPAN which will probably inherit from Exporter)).  That's it.  The
version strings will not be visible from user space (as such).  I am
not planning on adding a toke pass to run force_version() anything
the parser sees something like VERSION.

I am only proposing to use v-strings as the one and only method by
which Perl decides whether one version is higher than another. 
v-strings happen to sort in a natural order which allows this to 
DWIM, where ASCII is wrong sometimes and numeric testing is prone to 
notation errors.  Nothing I am doing changes v-strings (except for 
extracting the code from toke.c:scan_num).  Anything the three people 
on the list who understand Unicode can do, they can still do. ;~)

I am nowhere near the point where I can alter the nature of Perl.
I am just trying to shim in a little code here and there to do 
one thing: compare versions using v-strings.


Thanks for listening

John

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