Living with smart match breakage

Toby Wintermute tjc at
Thu Jul 4 08:41:31 BST 2013

On 15 June 2013 09:03, Gordon Banner <tech at> 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.


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.


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

More information about the mailing list