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

Re: Preliminary report of smoking perl 5.10.1

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
August 20, 2009 11:39
Subject:
Re: Preliminary report of smoking perl 5.10.1
Message ID:
20090820183903.GI9886@iabyn.com
On Thu, Aug 20, 2009 at 01:55:11PM +0100, Dave Mitchell wrote:
> Looking at the output, I see the basic changes in behaviour between 5.10.0
> and 5.10.1, given the following code, are:
> 
> 
>     package My::Class;
>     use overload '~~' => 'matches', '""' => 'to_string';
> 
>     ...
> 
>     my $obj = My::Class->new;
>     given ($obj) {
> 	...
> 
> Then the following when()s make the overload calls shown below.
> 
> 
>     when ( [1, 2, 3, 4] )
> 
> 	5.10.0:
> 
> 	       matches($obj, [ 1, 2, 3, 4 ], ''); 
> 
> 	5.10.1:
> 
> 	       matches($obj, 1, ''); 
> 	       matches($obj, 2, ''); 
> 	       matches($obj, 3, ''); 
> 	       matches($obj, 4, ''); 
> 
> 
>     when ( {a=>1, b=>2}  )
> 
> 	5.10.0:
> 
> 	       matches($obj, { 'a' => 1, 'b' => 2 }, ''); 
> 
> 	5.10.1:
> 
> 	       to_string($obj, 1, ''); 
> 
> 
> Anyone on p5p care to comment on this changed behaviour? (Since
> smartmatching isn't my area of expertise, and I've got to decide in the
> next day or two whether to scrub the 5.10.1 release, and no-one else seems
> to be saying anything....)

First off, with d7c0d2821cad1d2e5b6b3d6440e7c22bfaae9559 I've added
a -DM debugging flag to track smart match resolution, eg:

    $ p -DM -E'1  ~~ "1"'

    EXECUTING...

    (-e:1)	Starting smart match resolution
    (-e:1)	    applying rule Num-numish

Now need to play with it and think about the implications of what's
actually happening.

-- 
Lady Nancy Astor: If you were my husband, I would flavour your coffee
with poison.
Churchill: Madam - if I were your husband, I would drink 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