[Purdue-pm] postfix dereference

Rick Westerman westerman at purdue.edu
Thu Jul 17 10:56:53 PDT 2014


It does look unwieldy to me (I don't want to say "ugly" since the pumpking in his talk says that since it is Perl he "doesn't worry about ugliness).  For one thing why force a star at the end of the postfix?  E.g.,

$ref->@*
$ref->%*

More simple would be:

$ref->@
$ref->%

And if a slice is needed then

$ref->@{ 4 }

Or something like that.  In any case I can't see myself changing habits from the pre-fix dereference.



----- Original Message -----
> did purdue-pm discuss this new feature of perl 5.20 already? See
> http://perltricks.com/article/68/2014/2/13/Cool-new-Perl-feature--postfix-dereferencing
> for some examples, and for some deeper discussion of the why
> (especially the digram in number 3). There was a lot of discussion,
> mostly negative, when this was announce, for instance
> http://www.perlmonks.org/?node_id=1064016 . The comment by BrowserUK
> is particularly good (below)
> 
> 
> 
> 
> 
> Weird isn't it how differently people perceive particular syntaxes. I
> find the (long form) dereference syntaxes completely consistent and
> eminently readable (provided they are formatted correctly; which is
> short-hand for saying: the way I do it :)
> 
> • ${ <thing> } : reference thing as a scalar.
> • @{ <thing> } : reference thing as an array.
> • %{ <thing> } : reference thing as a hash.
> 
> 
> The internal whitespace around thing is imperative IMO, and with it,
> it is (I find it) totally clear, concise and consistent. The three
> holy Cs of syntax.
> 
> Personally, I would much rather have seen the short-forms ( $$ref ,
> @$ref & %$ref ) removed than have another, less concise, less
> orthogonal, less consistent, less in-keeping-with syntax, added.
> 
> Hm. That last part isn't quite right; let me try that again.
> 
> 1. Pointlessly more verbose.
> 2. Totally arbitrary.
> 3. Utterly inconsistent (with anything).
> 4. Confused and confusing.
> 5. Completely out of keeping.
> 6. Muddled and muddling.
> 7. Like fitting a wing mirror to your garden shed.
> 
> 
> Simply the pointless, capricious, because-we-can assertion of the
> ability to foist whimsy on us muggles. Of course, no one has to use
> it; but some will, and thus the damage is done.
> 
> In short, exactly what has gone wrong with p5p for the last few years.
> 
> 
> his point is backed up by dmitri who says
> 
> 
> 
> 
> 
> From the documentation (one of the links in the parent):
> 
> This syntax allows dereferencing to be written and read entirely
> left-to-right.
> Which is something I haven't paid attention to. I'd be willing to give
> this a try. [reply]
> 
> A final point, which relates to what we talked about last week, Davido
> says, and I agree
> 
> 
> 
> 
> This is an idea that sounds good in principle, and that is destined to
> turn out not so good. Problems:
> 
> • Additional complexity introduced to the Perl code base will
> undoubtedly lead to a new round of bug-fixes.
> • A new syntax that will begin to creep into modules and new code that
> push forward the minimum Perl version without significant benefit.
> • A new set of special cases. I can see it now in Intermediate Perl :
> "You may omit the -> operator between subscripts, but not between a
> reference and its flattener
> • If @{ $aref->[1] } is ugly, is $aref->[1]->@* prettier? At least the
> first seems mostly symmetrical, and visually distinctive. And it has
> the benefit of putting the most important thing first; we're
> generating a list. Beauty is in the eye of the beholder, but you would
> have to be an alien to find more beauty in the new construct than in
> the symmetry of the old one. Why do we need to put the most important
> part at the end? Discomforting, it is.
> • It doesn't make simple things easy, or hard things possible. And it
> really doesn't make impossible things possible. The barrier to entry
> into Perl syntax really ought to be, "Does it make hard things
> possible? Does it at least make simple things easier?"
> 
> 
> TIMTOWTDI doesn't mean we need to add every imaginable syntactic
> alternative.
> 
> 
> --
> Michael Gribskov
> Hockmeyer Hall of Structural Biology
> Department of Biological Sciences
> Purdue University
> 240 S. Martin Jischke Drive
> West Lafayette, IN 47907-1971 gribskov at purdue.edu vox: 765.494.6933
> fax: 765.496.1189
> calendar:
> http://www.google.com/calendar/embed?src=mgribskov%40gmail.com
> _______________________________________________
> Purdue-pm mailing list
> Purdue-pm at pm.org
> http://mail.pm.org/mailman/listinfo/purdue-pm

-- 
Rick Westerman 
westerman at purdue.edu

Bioinformatics specialist at the Genomics Facility.
Phone: (765) 494-0505           FAX: (765) 496-7255
Department of Horticulture and Landscape Architecture
625 Agriculture Mall Drive
West Lafayette, IN 47907-2010
Physically located in room S049, WSLR building


More information about the Purdue-pm mailing list