Re: Living with smart match breakage

2013-06-13 Thread Yitzchak Scott-Thoennes
On Thu, Jun 13, 2013 at 5:02 PM, Mark Fowler  wrote:
> On Thursday, June 13, 2013, Yitzchak Scott-Thoennes wrote:
>> I think it may be easier to list the cases that could be expected to
>> *continue* to work in the future;
>
> It's my understanding that smart match will continue to work *as* *is* in
> all future versions of Perl if you enable experimental smart match
> behaviour in your code. The point in the declaration is to say 'I want you
> to try to have the behaviour that existed when this was an experimental
> feature, not whatever the behaviour is now' - i.e. to tell whatever version
> of Perl your code is running on to always use smart match as it worked in
> 5.18.

I'm pretty out of touch, but I think that describes Jesse's plan for
backward compatibility of opcodes; however, this bit made me think
that wasn't the goal in this instance:
> After a lot of talk about making ~~ pluggable across different scopes, I 
> think it's a non-starter. It's just not the kind of thing we can plug this 
> way, because of the way in which we expect it to be used. If we expect users 
> to pass a test from their code to some other code, they need to know how that 
> code will use it. It needs to be the same everywhere.



Re: Living with smart match breakage

2013-06-13 Thread Mark Fowler
On Thursday, June 13, 2013, Yitzchak Scott-Thoennes wrote:

>
> I think it may be easier to list the cases that could be expected to
> *continue* to work in the future;


It's my understanding that smart match will continue to work *as* *is* in
all future versions of Perl if you enable experimental smart match
behaviour in your code. The point in the declaration is to say 'I want you
to try to have the behaviour that existed when this was an experimental
feature, not whatever the behaviour is now' - i.e. to tell whatever version
of Perl your code is running on to always use smart match as it worked in
5.18.

The *warning* in 5.18 is to tell you that you're *not* declaring you want
the current experimental behaviour (i.e. behaviour in 5.18 and previous
versions of Perl) but whatever behaviour some crazy person on p5p
implements in some yet to be written Perl.

Turning off the warnings (with 'no warnings') rather than using the
experimental feature (with 'use') is saying 'I don't want the code to work
as is but break when someone changes something'.

Hth

Mark


Re: Living with smart match breakage

2013-06-13 Thread Yitzchak Scott-Thoennes
On Thu, Jun 13, 2013 at 2:57 PM, gvim  wrote:
> The original request was for a pointer to any "definitive list" of edge
> cases for smart match breakage, not for solutions relating to code examples
> of my own.

I think it may be easier to list the cases that could be expected to
*continue* to work in the future; a recent stackoverflow question
about this issue linked to this p5p post that does so, from one
person's point of view: http://markmail.org/message/u22titrq5ljclz4b

I have no clue how well that lines up with up-to-the-minute
p5p-hivemind thought.


Re: Living with smart match breakage

2013-06-13 Thread David Cantrell
On Thu, Jun 13, 2013 at 10:15:56PM +0100, gvim wrote:

> I hear Perl 5.18 issues warnings when the smart match operator is used 
> and some convoluted boilerplate is necessary to work around them.

Don't be such a drama queen. This:

  use experimental 'smartmatch';

isn't "convoluted boilerplate".

-- 
David Cantrell | Official London Perl Mongers Bad Influence

Anyone who cannot cope with mathematics is not fully human.
At best he is a tolerable subhuman who has learned to wear
shoes, bathe and not make messes in the house.
   -- Robert A Heinlein


Re: Living with smart match breakage

2013-06-13 Thread gvim

On 13/06/2013 22:28, Marcel GrĂ¼nauer wrote:


Unfortunately my crystal ball is in the shop this week, so maybe if you could 
post the relevant code, it might be possible to give a relevant answer as to 
whether the relevant issue is relevant to the relevant code.

Marcel


The original request was for a pointer to any "definitive list" of edge 
cases for smart match breakage, not for solutions relating to code 
examples of my own.


gvim




Re: Living with smart match breakage

2013-06-13 Thread Gianni Ceccarelli
On 2013-06-13 gvim  wrote:
> I hear Perl 5.18 issues warnings when the smart match operator is
> used

Yes, and also when C / C are used.

> and some convoluted boilerplate is necessary to work around
> them.

That boilerplate is spelled:

   no warnings 'experimental::smartmatch';

or, if you want your code to work unmodified under 5.16 and 5.18 (and
probably all other versions):

  use experimental 'smartmatch';

(see https://metacpan.org/release/experimental )

> Since my use of given/when and smart match is quite simplistic

Good.

> I'm wondering if the breakage is relevant to the code I write.

Probably not, but my definition of "simplistic" may not be the same as
yours.


> A quick search hasn't produced any definitive list of these edge
> cases

Let's put it like this: if you are not daunted by the documentation of
the C<~~> operator (see L, 23 cases), and
by the additional cases when it's used inside C (see
L, 10 more cases), you
are much smarter and brave than I am.

> My approach is to keep it simple and defer upgrading beyond 5.16
> until it's fixed.

My approach is to keep using it in the 2-3 cases we already do
(essentially, dispatch based on exception objects inside a
L C coderef), adding C where appropriate.

-- 
Dakkar - 
GPG public key fingerprint = A071 E618 DD2C 5901 9574
 6FE2 40EA 9883 7519 3F88
key id = 0x75193F88

It is easy to find fault, if one has that disposition.  There was once
a man who, not being able to find any other fault with his coal,
complained that there were too many prehistoric toads in it.
-- Mark Twain, "Pudd'nhead Wilson's Calendar"


Re: Living with smart match breakage

2013-06-13 Thread Marcel GrĂ¼nauer
On Jun 13, 2013, at 11:15 PM, gvim  wrote:

> I hear Perl 5.18 issues warnings when the smart match operator is used and 
> some convoluted boilerplate is necessary to work around them. Since my use of 
> given/when and smart match is quite simplistic I'm wondering if the breakage 
> is relevant to the code I write. A quick search hasn't produced any 
> definitive list of these edge cases so can anyone point me in the right 
> direction? My approach is to keep it simple and defer upgrading beyond 5.16 
> until it's fixed.

Unfortunately my crystal ball is in the shop this week, so maybe if you could 
post the relevant code, it might be possible to give a relevant answer as to 
whether the relevant issue is relevant to the relevant code.

Marcel




Living with smart match breakage

2013-06-13 Thread gvim
I hear Perl 5.18 issues warnings when the smart match operator is used 
and some convoluted boilerplate is necessary to work around them. Since 
my use of given/when and smart match is quite simplistic I'm wondering 
if the breakage is relevant to the code I write. A quick search hasn't 
produced any definitive list of these edge cases so can anyone point me 
in the right direction? My approach is to keep it simple and defer 
upgrading beyond 5.16 until it's fixed.


gvim