Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20

by BrowserUk (Pope)
on Nov 23, 2013 at 09:44 UTC ( #1064021=note: print w/ replies, xml ) Need Help??


in reply to use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20

Just one question: Why?

It's no less characters; it's not clearer; it's not consistent with anything. A completely pointless addition.


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.


Comment on Re: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20
Re^2: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20
by Anonymous Monk on Nov 23, 2013 at 10:19 UTC
    Seems like the feature is for its own sake.
Re^2: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20
by choroba (Abbot) on Nov 23, 2013 at 11:23 UTC
    I find the current syntax ugly and not readable:
    @{ $ref1->[0]{a} }

    Unfortunatelly, I do not find the new syntax any better. Was there any discussion? Any other options? Like $ref%-> or $ref-><ARRAY> or $ref->>% or whatever?

    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

      1) if there are links, explore them :) 2) make links obviou 3) hi

      Basically, rjbs/d.golden really wanted it

        Jolly Crap Man! Thanks for the multitude of links, and thus the background.

        First I thought that unquoted text segments with links were your observations, but seems like they are the quotes of the email authors.

      I find the current syntax ugly and not readable:

      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.


      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.

        Indeed. And if postfix dereferencing was deemed so necessary, I think there are better ways it could have been accomplished. In particular, if autoboxing were made a core feature (and there are widely used autoboxing extensions on CPAN already as proof of concept) then we could just define methods:

        sub SCALAR::SCALAR { ${+shift} } sub ARRAY::ARRAY { @{+shift} } sub HASH::HASH { %{+shift} }

        And hey presto! Postfix dereferencing!

        my $scalar = $sref->SCALAR; my @array = $aref->ARRAY; my %hash = $href->HASH;
        use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name
Re^2: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20
by vkon (Deacon) on Nov 24, 2013 at 16:11 UTC
    i share same opinion, I dislike this new feature...

    pity there's no voting booth where I can raise my '--' vote...

Re^2: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20
by ysth (Canon) on Dec 02, 2013 at 01:25 UTC
    Because it makes (some) code easier to read left-to-right, with no mental notes to figure out what is being dereferenced later on. It's really that simple.
    --
    A math joke: r = | |csc(θ)|+|sec(θ)| |-| |csc(θ)|-|sec(θ)| |
      easier to read left-to-right

      In the absence of evidence, opinion is ...


      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.

        You were somehow expecting an answer to your "Why?" that didn't involve opinion?

        --
        A math joke: r = | |csc(θ)|+|sec(θ)| |-| |csc(θ)|-|sec(θ)| |
Re^2: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20
by dmitri (Curate) on Dec 14, 2013 at 17:52 UTC
    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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1064021]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (15)
As of 2014-10-20 18:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (88 votes), past polls