Re: Living with smart match breakage

2013-07-04 Thread Toby Wintermute
On 15 June 2013 09:03, Gordon Banner t...@gordonbanner.me.uk wrote:
 Putting my hand up as one of the idiots...

 I've been using given/when for ages.  My impression was that it was
 announced as a new feature, yay perl has a case statement (only better) at
 last, and I piled in.  Maybe I passed danger signals on the way, but not
 consciously.  Lots of books/presentations promoted it, and I don't remember
 the small print.

 Marking it as experimental now seems to me to be rewriting history, what we
 wish we'd said at the time.  The 5.10 perlsyn page for example does not give
 any warnings at all.

 I defend the option to change the language and remove broken stuff, but I'm
 slightly peeved to be labelled a bleeding-edge cowboy for using something
 that has been promoted widely for years.

+1

I've  appreciated using given/when with the saner end of smartmatching
and after it's been around for six major versions of Perl, felt like
it was something one could keep relying upon. By all means introduce a
new smartERmatch, but it is annoying to have the old operator
deprecated without even having the replacement ready yet.

 Finally, the OP mentioned convoluted boilerplate and was offered

 no warnings 'experimental::smartmatch';
 # or
 use experimental 'smartmatch';

 If you think that's memorable and quick to type, your brain and fingers must
 move faster than mine, or you program in an IDE.  By the time you've knocked
 that lot out you might as well type a bunch of elsifs anyway.

Try putting either of those in a Perl version prior to 5.17! It just
fails out at compile time.
I reckon the convoluted boilerplate mentioned involves putting tests
for perl versions around those, which is indeed convoluted.

-T

--
Turning and turning in the widening gyre
The falcon cannot hear the falconer
Things fall apart; the center cannot hold
Mere anarchy is loosed upon the world


Re: Living with smart match breakage

2013-07-04 Thread David Cantrell
On Thu, Jul 04, 2013 at 05:41:31PM +1000, Toby Wintermute wrote:
 On 15 June 2013 09:03, Gordon Banner t...@gordonbanner.me.uk wrote:
  Finally, the OP mentioned convoluted boilerplate and was offered
 
  no warnings 'experimental::smartmatch';
  # or
  use experimental 'smartmatch';
 Try putting either of those in a Perl version prior to 5.17! It just
 fails out at compile time.

Really?

$ perl -E 'use experimental smartmatch;say it works in perl $^V'
it works in perl v5.12.4

 I reckon the convoluted boilerplate mentioned involves putting tests
 for perl versions around those, which is indeed convoluted.

It's a good thing that the 'experimental' pragma does that for you then.

-- 
David Cantrell | Bourgeois reactionary pig

  I remember when computers were frustrating because they did
  exactly what you told them to.  That seems kinda quaint now.
  -- JD Baldwin, in the Monastery


Re: Living with smart match breakage

2013-07-04 Thread Gareth Harper
On 4 July 2013 11:11, David Cantrell da...@cantrell.org.uk wrote:

 On Thu, Jul 04, 2013 at 05:41:31PM +1000, Toby Wintermute wrote:
  On 15 June 2013 09:03, Gordon Banner t...@gordonbanner.me.uk wrote:
   Finally, the OP mentioned convoluted boilerplate and was offered
  
   no warnings 'experimental::smartmatch';
   # or
   use experimental 'smartmatch';
  Try putting either of those in a Perl version prior to 5.17! It just
  fails out at compile time.

 Really?

 $ perl -E 'use experimental smartmatch;say it works in perl $^V'
 it works in perl v5.12.4

  I reckon the convoluted boilerplate mentioned involves putting tests
  for perl versions around those, which is indeed convoluted.

 It's a good thing that the 'experimental' pragma does that for you then.


perl -E 'use experimental smartmatch;say it works in perl $^V'
Can't locate experimental.pm in @INC (@INC contains: /etc/perl
/usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5
/usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14
/usr/local/lib/site_perl .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.


perl -v

This is perl 5, version 14, subversion 2 (v5.14.2) built for
i486-linux-gnu-thread-multi-64int


Re: Living with smart match breakage

2013-07-04 Thread Gareth Harper
On 4 July 2013 11:30, Gareth Harper spansh+lon...@gmail.com wrote:

 perl -E 'use experimental smartmatch;say it works in perl $^V'
 Can't locate experimental.pm in @INC (@INC contains: /etc/perl
 /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5
 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14
 /usr/local/lib/site_perl .) at -e line 1.
 BEGIN failed--compilation aborted at -e line 1.


 perl -v

 This is perl 5, version 14, subversion 2 (v5.14.2) built for
 i486-linux-gnu-thread-multi-64int


My bad, after I had assumed use experimental was the same as use strict
or use feature.

After installing experimental from cpan I get.


perl -E 'use experimental smartmatch;say it works in perl $^V'
it works in perl v5.14.2


Re: Living with smart match breakage

2013-07-04 Thread Abigail
On Thu, Jul 04, 2013 at 11:35:34AM +0100, Gareth Harper wrote:
 On 4 July 2013 11:30, Gareth Harper spansh+lon...@gmail.com wrote:
 
  perl -E 'use experimental smartmatch;say it works in perl $^V'
  Can't locate experimental.pm in @INC (@INC contains: /etc/perl
  /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5
  /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14
  /usr/local/lib/site_perl .) at -e line 1.
  BEGIN failed--compilation aborted at -e line 1.
 
 
  perl -v
 
  This is perl 5, version 14, subversion 2 (v5.14.2) built for
  i486-linux-gnu-thread-multi-64int
 
 
 My bad, after I had assumed use experimental was the same as use strict
 or use feature.

And it is:

   $ /opt/perl/5.8.9/bin/perl -le 'BEGIN {print $]} use feature;'
   5.008009
   Can't locate feature.pm in @INC (@INC contains: ... .) at -e line 1.
   BEGIN failed--compilation aborted at -e line 1.

Each of strict, feature, and experimental, are perl module, and
for each of them, there's a certain minimum version for which they are
part of the standard distribution. (5.000 for strict.pm, 5.10.0 for 
feature.pm, and 5.14.0 for experimental.pm).



Abigail


Re: Living with smart match breakage

2013-07-04 Thread Abigail
On Thu, Jul 04, 2013 at 12:40:34PM +0100, Gareth Harper wrote:
 On 4 July 2013 12:23, Abigail abig...@abigail.be wrote:
 
  And it is:
 
 $ /opt/perl/5.8.9/bin/perl -le 'BEGIN {print $]} use feature;'
 5.008009
 Can't locate feature.pm in @INC (@INC contains: ... .) at -e line 1.
 BEGIN failed--compilation aborted at -e line 1.
 
  Each of strict, feature, and experimental, are perl module, and
  for each of them, there's a certain minimum version for which they are
  part of the standard distribution. (5.000 for strict.pm, 5.10.0 for
  feature.pm, and 5.14.0 for experimental.pm).
 
 
 Are you sure about 5.14.0 for experimental.pm, I ran it on 5.14.2 and had
 to manually install from cpan in order for it to work (see higher up in the
 thread).
 


I meant 5.16.0.


Abigail


Re: Living with smart match breakage

2013-07-04 Thread Matt Lawrence

On 04/07/13 13:03, Abigail wrote:

On Thu, Jul 04, 2013 at 12:40:34PM +0100, Gareth Harper wrote:

On 4 July 2013 12:23, Abigail abig...@abigail.be wrote:


And it is:

$ /opt/perl/5.8.9/bin/perl -le 'BEGIN {print $]} use feature;'
5.008009
Can't locate feature.pm in @INC (@INC contains: ... .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

Each of strict, feature, and experimental, are perl module, and
for each of them, there's a certain minimum version for which they are
part of the standard distribution. (5.000 for strict.pm, 5.10.0 for
feature.pm, and 5.14.0 for experimental.pm).


Are you sure about 5.14.0 for experimental.pm, I ran it on 5.14.2 and had
to manually install from cpan in order for it to work (see higher up in the
thread).



I meant 5.16.0.


Abigail


Doesn't look like it:

$ corelist experimental
Data for 2013-06-21
experimental was not in CORE (or so I think)

$ perl -v
This is perl 5, version 16, subversion 3 (v5.16.3) built for i686-linux

$ perl -Mexperimental -ce 1
perl -Mexperimental -ce 1
Can't locate experimental.pm in @INC ...


Re: Living with smart match breakage

2013-07-04 Thread Fred Youhanaie



On 04/07/13 13:03, Abigail wrote:

On Thu, Jul 04, 2013 at 12:40:34PM +0100, Gareth Harper wrote:

On 4 July 2013 12:23, Abigail abig...@abigail.be wrote:


And it is:

$ /opt/perl/5.8.9/bin/perl -le 'BEGIN {print $]} use feature;'
5.008009
Can't locate feature.pm in @INC (@INC contains: ... .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

Each of strict, feature, and experimental, are perl module, and
for each of them, there's a certain minimum version for which they are
part of the standard distribution. (5.000 for strict.pm, 5.10.0 for
feature.pm, and 5.14.0 for experimental.pm).



Are you sure about 5.14.0 for experimental.pm, I ran it on 5.14.2 and had
to manually install from cpan in order for it to work (see higher up in the
thread).




I meant 5.16.0.


Abigail



Are you sure?

perl -E 'use experimental smartmatch;say it works in perl $^V'
Can't locate experimental.pm in @INC (@INC contains: /opt/perl-5.16.2/lib/site_perl/5.16.2/i686-linux /opt/perl-5.16.2/lib/site_perl/5.16.2 /opt/perl-5.16.2/lib/5.16.2/i686-linux 
/opt/perl-5.16.2/lib/5.16.2 .) at -e line 1.

BEGIN failed--compilation aborted at -e line 1.

Any advances on 16? ;-)

google sez 5.18.0 :-)
http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#New_mechanism_for_experimental_features


Fred



Re: Living with smart match breakage

2013-07-04 Thread Michael Jemmeson
On 4 July 2013 13:24, Fred Youhanaie f...@anydata.co.uk wrote:

 perl -E 'use experimental smartmatch;say it works in perl $^V'
 Can't locate experimental.pm in @INC (@INC contains:
 /opt/perl-5.16.2/lib/site_perl/5.16.2/i686-linux
 /opt/perl-5.16.2/lib/site_perl/5.16.2 /opt/perl-5.16.2/lib/5.16.2/i686-linux
 /opt/perl-5.16.2/lib/5.16.2 .) at -e line 1.

 BEGIN failed--compilation aborted at -e line 1.

 Any advances on 16? ;-)

 google sez 5.18.0 :-)
 http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#New_mechanism_for_experimental_features


That's the 'experimental' warnings category. The 'experimental' module
(https://metacpan.org/module/experimental ) which provides a simpler
way to use them is not core as of 5.18


Re: Living with smart match breakage

2013-06-15 Thread David Cantrell
On Sat, Jun 15, 2013 at 12:03:20AM +0100, Gordon Banner wrote:

 Finally, the OP mentioned convoluted boilerplate and was offered
 
 no warnings 'experimental::smartmatch';
 # or
 use experimental 'smartmatch';
 
 If you think that's memorable and quick to type

The complaint wasn't about stuff being hard to remember or type, but
about it being convoluted.  They're different.

-- 
David Cantrell | Hero of the Information Age

Never attribute to malice that which can be explained by stupidity
-- Hanlon's Razor

Stupidity maintained long enough is a form of malice
-- Richard Bos's corollary


Re: Living with smart match breakage

2013-06-14 Thread Smylers
gvim writes:

 The original request was for a pointer to any definitive list of
 edge cases for smart match breakage,

There isn't such a list -- its experimental nature means anything
might change. P5P doesn't have consensus, and no decision has been made
on what's going to happen.

There are some on P5P suggesting that smartmatch is so broken it should
be removed entirely.

Personally I liked RJBS's proposal, but not everybody else did.

Smylers
-- 
Stop drug companies hiding negative research results.
Sign the AllTrials petition to get all clinical research results published.
Read more: http://www.alltrials.net/blog/the-alltrials-campaign/


Re: Living with smart match breakage

2013-06-14 Thread jason

On 2013-06-14 09:11, Smylers wrote:

There isn't such a list -- its experimental nature means anything
might change. P5P doesn't have consensus, and no decision has been 
made

on what's going to happen.

There are some on P5P suggesting that smartmatch is so broken it 
should

be removed entirely.


That was the impression I got from the sparse details in the 5.18 
announcement and what worried me more than anything else was precisely 
that uncertainty.


That there is no consensus that at least some of smart match and thus, 
given/when, can be considered non-experimental (and thus safe to use in 
production) means that a lot of application and library code may have to 
be rewritten at some point but nobody is really able to definitively 
determine what the scale of that risk is.


Certainly we can continue to declare use experimental and things will 
continue to work but that is a risky strategy.




Re: Living with smart match breakage

2013-06-14 Thread Dave Hodgkinson
A lot of? Are people really using this in production code now?

Sent from my iPhone

On 14 Jun 2013, at 09:32, jason ja...@ukfsn.org wrote:

 On 2013-06-14 09:11, Smylers wrote:
 There isn't such a list -- its experimental nature means anything
 might change. P5P doesn't have consensus, and no decision has been made
 on what's going to happen.
 
 There are some on P5P suggesting that smartmatch is so broken it should
 be removed entirely.
 
 That was the impression I got from the sparse details in the 5.18 
 announcement and what worried me more than anything else was precisely that 
 uncertainty.
 
 That there is no consensus that at least some of smart match and thus, 
 given/when, can be considered non-experimental (and thus safe to use in 
 production) means that a lot of application and library code may have to be 
 rewritten at some point but nobody is really able to definitively determine 
 what the scale of that risk is.
 
 Certainly we can continue to declare use experimental and things will 
 continue to work but that is a risky strategy.
 



Re: Living with smart match breakage

2013-06-14 Thread Kieren Diment
Presumably CPAN testing of a blead perl with smartmatch removed/deprecated 
could pick that up pretty quickly.  I mean I have under-used experimental cpan 
modules that have some test failures, but if they suddenly started throwing do 
not compile errors[1], even I would pick them up.

[1] Not that I use many of the newer core features, occasionally I have to 
account for some of my $work code having to work on 5.8.

On 14/06/2013, at 6:32 PM, jason wrote:

 On 2013-06-14 09:11, Smylers wrote:
 There isn't such a list -- its experimental nature means anything
 might change. P5P doesn't have consensus, and no decision has been made
 on what's going to happen.
 
 There are some on P5P suggesting that smartmatch is so broken it should
 be removed entirely.
 
 That was the impression I got from the sparse details in the 5.18 
 announcement and what worried me more than anything else was precisely that 
 uncertainty.
 
 That there is no consensus that at least some of smart match and thus, 
 given/when, can be considered non-experimental (and thus safe to use in 
 production) means that a lot of application and library code may have to be 
 rewritten at some point but nobody is really able to definitively determine 
 what the scale of that risk is.
 
 Certainly we can continue to declare use experimental and things will 
 continue to work but that is a risky strategy.
 




Re: Living with smart match breakage

2013-06-14 Thread James Laver
On 14 Jun 2013, at 10:26, Kieren Diment dim...@gmail.com wrote:

 [1] Not that I use many of the newer core features, occasionally I have to 
 account for some of my $work code having to work on 5.8.

I don't use smart match precisely because it doesn't feel intuitive and I have 
enough to worry about without having to memorise yet another table of results, 
some of which are surprising.

I suspect most people are in the same boat, but the darkpan argument always 
gets trotted out in these cases. The solution you present of a Perl release 
that fails compile would be nice though. Perhaps with a switch in a new release 
of Perl?

James


Re: Living with smart match breakage

2013-06-14 Thread David Cantrell
On Fri, Jun 14, 2013 at 09:32:00AM +0100, jason wrote:
 On 2013-06-14 09:11, Smylers wrote:
 There isn't such a list -- its experimental nature means anything
 might change. P5P doesn't have consensus, and no decision has been 
 made
 on what's going to happen.
 
 There are some on P5P suggesting that smartmatch is so broken it 
 should be removed entirely.
 That there is no consensus that at least some of smart match and thus, 
 given/when, can be considered non-experimental (and thus safe to use in 
 production) means that a lot of application and library code may have to 
 be rewritten at some point but nobody is really able to definitively 
 determine what the scale of that risk is.

I ASSume that before it's removed, someone will make sure that there's
something on the CPAN that will be a drop-in replacement in almost all
cases. IIRC Zefram worked some dark magic to let you define custom
operators using XS.

-- 
David Cantrell | semi-evolved ape-thing

There are many different types of sausages.  The best are
from the north of England.  The wurst are from Germany.
  -- seen in alt.2eggs...


Re: Living with smart match breakage

2013-06-14 Thread Jason Clifford
On Fri, 2013-06-14 at 19:26 +1000, Kieren Diment wrote:
 Presumably CPAN testing of a blead perl with smartmatch removed/deprecated 
 could pick that up pretty quickly.

Automated CPAN testing occurs on new releases of modules only doesn't it
or is there comprehensive testing of every current release on CPAN when
a new perl is being prepared for release?

Even if you catch everything in CPAN that doesn't address the risk for
in house libraries which is an issue for many of those using perl in
production and doesn't address application code using smart match or
given/when.

My point was more about the difficulty this uncertainty causes in
assessing the risk that it will be necessary to rewrite libraries and
applications.




Re: Living with smart match breakage

2013-06-14 Thread Nicholas Clark
On Fri, Jun 14, 2013 at 02:13:00PM +0100, Jason Clifford wrote:
 On Fri, 2013-06-14 at 19:26 +1000, Kieren Diment wrote:
  Presumably CPAN testing of a blead perl with smartmatch removed/deprecated 
  could pick that up pretty quickly.
 
 Automated CPAN testing occurs on new releases of modules only doesn't it
 or is there comprehensive testing of every current release on CPAN when
 a new perl is being prepared for release?

For several years now Andreas König has been smoking existing CPAN modules
using development versions of perl. He's found (and we've fixed) a lot of
problems before anyone ever realised that they existed.

Nicholas Clark


Re: Living with smart match breakage

2013-06-14 Thread David Cantrell
On Fri, Jun 14, 2013 at 02:13:00PM +0100, Jason Clifford wrote:
 On Fri, 2013-06-14 at 19:26 +1000, Kieren Diment wrote:
  Presumably CPAN testing of a blead perl with smartmatch removed/deprecated 
  could pick that up pretty quickly.
 Automated CPAN testing occurs on new releases of modules only doesn't it
 or is there comprehensive testing of every current release on CPAN when
 a new perl is being prepared for release?

There are a few people who run all of the CPAN past new perl releases
these days, especially perl release candidates.

-- 
David Cantrell | even more awesome than a panda-fur coat

I think the most difficult moment that anyone could face is seeing
their domestic servants, whether maid or drivers, run away
  -- Abdul Rahman Al-Sheikh, writing on 25 Jan 2004 at
 http://archive.arabnews.com/?article=38558


Re: Living with smart match breakage

2013-06-14 Thread Abigail
On Fri, Jun 14, 2013 at 07:26:39PM +1000, Kieren Diment wrote:
 Presumably CPAN testing of a blead perl with smartmatch removed/deprecated 
 could pick that up pretty quickly.  I mean I have under-used experimental 
 cpan modules that have some test failures, but if they suddenly started 
 throwing do not compile errors[1], even I would pick them up.
 
 [1] Not that I use many of the newer core features, occasionally I have to 
 account for some of my $work code having to work on 5.8.


I've placed the comment When we move away from 5.8, perhaps replace
this with given/when several times at $WORK. It took us quite a number
of years to move away from 5.8.5 (and we're still trailing a couple
of releases).

But now, it won't make sense to use given/when, if it may change in
the future. But someone is going to use given/when at some point in
time, putting another hurdle for an upgrade to 5.18 or beyond (whenever
that may be). (If you hire more than a handful of new devs each month,
someone will not have gotten the memo).

Turning on warnings for using a construct more than *five* years after it
was introduced doesn't make Perl win any brownie points for an outsider
(yes, I understand the reasons, and no, I don't have a better solution).



Abigail


Re: Living with smart match breakage

2013-06-14 Thread Mark Fowler
On Friday, 14 June 2013 at 07:51, David Cantrell wrote:
 IIRC Zefram worked some dark magic to let you define custom
 operators using XS.


Interesting.  Quick, someone write a module that lets you hook this in Perl 
space and then let the experimentation begin.  After all, it doesn't have to be 
efficient when we're prototyping, just able to iterate through stuff quickly.

Even if we don't come up with a good set of behaviours there has to be some 
awesome possibilities for Acme modules in there.

Mark.




Re: Living with smart match breakage

2013-06-14 Thread Graeme Hewson
On Friday 14 Jun 2013 16:29:23 Abigail wrote:

 (If you hire more than a handful of new devs each month,
 someone will not have gotten the memo).

Some people will think they /have/ got the memo because the feature's been 
written about in the Camel book, Modern Perl, and no doubt other books too.


Re: Living with smart match breakage

2013-06-14 Thread Gordon Banner

Putting my hand up as one of the idiots...

I've been using given/when for ages.  My impression was that it was 
announced as a new feature, yay perl has a case statement (only better) 
at last, and I piled in.  Maybe I passed danger signals on the way, but 
not consciously.  Lots of books/presentations promoted it, and I don't 
remember the small print.


Marking it as experimental now seems to me to be rewriting history, what 
we wish we'd said at the time.  The 5.10 perlsyn page for example does 
not give any warnings at all.


I defend the option to change the language and remove broken stuff, but 
I'm slightly peeved to be labelled a bleeding-edge cowboy for using 
something that has been promoted widely for years.


A quote from the 4th edition Camel, at the end of *5 pages* of 
discussion of given/when:


   We still consider some of the darker corners of given and when to
   be experimental, but please be assured that in practice most of your
   switch statements are likely to be based on simple string or number
   matches, and these will always work the way you expect.

I want my matches - just about all of them simple string or number 
matches - to always work, please.



Finally, the OP mentioned convoluted boilerplate and was offered

no warnings 'experimental::smartmatch';
# or
use experimental 'smartmatch';

If you think that's memorable and quick to type, your brain and fingers 
must move faster than mine, or you program in an IDE.  By the time 
you've knocked that lot out you might as well type a bunch of elsifs anyway.



Slightly more annoyed than I expected to be at the beginning of this rant,
Gordon

On 14/06/2013 16:09, Graeme Hewson wrote:

On Friday 14 Jun 2013 16:29:23 Abigail wrote:


(If you hire more than a handful of new devs each month,
someone will not have gotten the memo).

Some people will think they /have/ got the memo because the feature's been
written about in the Camel book, Modern Perl, and no doubt other books too.




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


Re: Living with smart match breakage

2013-06-13 Thread Marcel Grünauer
On Jun 13, 2013, at 11:15 PM, gvim gvi...@gmail.com 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




Re: Living with smart match breakage

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

Yes, and also when Cgiven / Cwhen 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 Lperlop/Smartmatch Operator, 23 cases), and
by the additional cases when it's used inside Cwhen (see
Lperlsyn/Experimental Details on given and when, 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
LTry::Tiny Ccatch coderef), adding Cuse experimental
'smartmatch' where appropriate.

-- 
Dakkar - Mobilis in mobile
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 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 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 Yitzchak Scott-Thoennes
On Thu, Jun 13, 2013 at 2:57 PM, gvim gvi...@gmail.com 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 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 5:02 PM, Mark Fowler m...@twoshortplanks.com 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.