develooper Front page | perl.perl5.porters | Postings from December 2015

Re: Proposal: Add {-as => 'new_name'} feature to

Thread Previous | Thread Next
December 22, 2015 08:37
Re: Proposal: Add {-as => 'new_name'} feature to
Message ID:
On Mon, Dec 21, 2015 at 07:12:30PM -0500, Ricardo Signes wrote:
> 2.  Is the { -as => "newname" } implementation the right one?
>     Well, I think I pioneered this form of this feature in Sub::Exporter, so
>     I'm partial to it... but in Sub::Exporter, that hashref can contain all
>     sorts of other things that can be put to use.  In Exporter, not so much.
>     Would it be better to provide a less "open" data structure for this
>     mapping, like a list of pairs, marked off by some kind of sentinel?  (For
>     example, an arrayref of pairs.  The exact form is not necessarily
>     interesting.)
>     I'm not really sold.  I think the hashref is okay.  We can validate that
>     the only entry in it is "-as", to prevent crazy mistakes.

Although I find "{-as => 'newname'}" a bit clunky -- a whole hashref
for a single feature, the openness of this structure means there's room
for other enhancements in the future: no need to invent yet another
syntax; one can just add another key/value pair in the hashref.


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