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

Re: fixing smartmatch just hard enough (and when, too)

Thread Previous | Thread Next
From:
Ricardo Signes
Date:
August 23, 2012 17:52
Subject:
Re: fixing smartmatch just hard enough (and when, too)
Message ID:
20120824005230.GA23667@cancer.codesimply.com
* Leon Timmermans <fawaka@gmail.com> [2012-08-23T15:50:07]
> I suspect in practice junctions may be the only use-case for it. I
> can't think of any other use-case. I don't think it's a good idea to
> special case, TBH.

Check out autodie::exception.

  try {
    use autodie;
    open my $fh, '<', '/dev/fail';
    ...
  } catch {
    if ($_ ~~ 'open') { ... }
  };

This behavior would fail without lhs overloading.  I'm not saying whether this
is a bad this, just now, but what's a programmer to do, here?  Overload eq?

So, I wanted to show that this is not only for junctions, and is already in
use, and to ask what you think of it.

-- 
rjbs

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