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

Proposal: Start making roads to reduce 'indirect' usage

Thread Next
From:
Kent Fredric
Date:
August 12, 2013 23:35
Subject:
Proposal: Start making roads to reduce 'indirect' usage
Message ID:
CAATnKFAkor-59T-SOc4D1v6yyCsMyZMWwKPWzhmw0CqvswakLA@mail.gmail.com
Indirect method invocation is one of the most well known warts that is
still legal syntax, at least, it is as far as I know.
Every time you see it, people tell you not to use it.

I have personally had more problems as a result of *accidentally*
using it, than I have ever *intentionally* wanted to use it.

And it being supported in normal perl code by default is something the
majority of users don't want, and its presence adds room for several
kinds of bugs ( for instance, if you omit a semi-colon in the right
place, your '=head1 FOO' POD will be interpreted as ' = Foo->head1 '.
GREAT! ).

I gave the archives a look, and there didn't seem to be any discussion
in this direction, other than removal of indirect from documentation.


So, here is my proposal, but none of it is suggested concrete:

1. Implement the existing 'indirect.pm' (vpit++) in core functionality.
2. slate some future version of perl to ship in such a way that "use
5.N" implies 'no indirect'  ( which is just a warning )
3. slate version of perl to ship in such a way that "use 5.N" implies
'no indirect q[fatal]'


Maybe down the road it might be acceptable to globally disable it
regardless of 'use 5.N", but we can jump that bridge when we come to
it. ( Read: I'm not saying we break any existing code, one should have
to invoke 'use 5.N" for the foreseeable future to get their code
broken )

-- 
Kent

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