Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333] : superdoc . print w/replies, xml ) Need Help??
It may be superseded by more recent p5p discussions about a "postfix dereference" operator.

Which would be an even more useless, fad-driven, change-for-change's-sake, distraction to nowhere than auto-dereferencing.

The justifiction for this: @{ $ref } becoming: $ref->@* or $ref->[] (empty brackets) or dog-knows what else is: Blech

I ask you. The technical justifiction is "Blech".

Funnily enough, I agree that this: push @{ $x->{foo}->[0]->m }, $y; is a bit ugly.

But who writes code like that anyway? And what would it mean if they did?

Let's break that mother down:

  1. $x is a reference
  2. to a hash that has a key 'foo'
  3. who's value is an array
  4. of objects that have a method 'm'
  5. that takes no arguments and returns a reference to an array
  6. onto which we need to push values.

Why would anyone invent an api that requires you to call a method to get a reference to an (internal) array onto which we are to push values; rather than just passing the values to be pushed to a method that does it for us?

Yes, I know it is an invented, over-the-top example to make a point.

And that's my point. If you have to use an invented, over-the-top example to justify something; you've failed.

Cos, $x{foo}[0]->push( $y ) is clean, simple and obvious. And it works right now.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^2: Is auto-dereferencing worth forcing upgrades to newer versions of Perl? by BrowserUk
in thread Is auto-dereferencing worth forcing upgrades to newer versions of Perl? by boftx

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.