develooper Front page | perl.perl5.porters | Postings from September 2016

Re: pounding the smartmatch drum

Thread Previous | Thread Next
Aristotle Pagaltzis
September 9, 2016 11:50
Re: pounding the smartmatch drum
Message ID:
* Zefram <> [2016-09-08 03:24]:
> Aristotle Pagaltzis wrote:
> >Without LHS overloading the given($@) API in autodie is unimplementable.
> If it's regarded as an API, that was always a faulty one. The matching
> implemented by the suggested idiom has never actually been what it
> purported to be, because matching rules other than
> autodie::exception's ~~ lhs overload would get involved anywhere that
> the exception was not of that class. We shouldn't be tied down by an
> erroneous use of an experimental feature.

Then again, if we split LHS from RHS overloads and LHS overloads become
rare then that problem should be substantially contained.

> The API that actually works, $@->isa("autodie::exception") &&
> $@->matches("open"), will remain.

Frankly I had forgotten about that.

> > We promoted that pragma to users as a good idea for years. We can't
> > just renege on that.
> You're overstating the case. This wouldn't diminish the functionality
> or usefulness of the autodie pragma. It only affects the use of
> autodie *in combination with given*.

You’re reading my statement more concretely than it was meant. The point
is that anyone just reading the autodie POD would even today not know to
assume anything amiss with the given($@) interface.

> Admittedly that's a use suggested by the autodie documentation,


> but code doing it already incurs a "given is experimental" warning.

True. (At least on recentish perls.)  That’s a fair point.

> > And to do so we would first have to add an alternative to autodie
> > and to deprecate the given($@) API for some time.
> We do not need an alternative to autodie. We only need to change its
> documentation to stop recommending the faulty use of given.

Sorry, I mangled my intention by too much editing. I meant we need an
alternative to the given($@) API. As mentioned, I had forgotten the
$@->matches($foo) API. So that part of the equation is already in place.

Aristotle Pagaltzis // <>

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About