Re^2: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20
by choroba (Bishop) 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?
| [reply] [d/l] [select] |
|
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.
- Pointlessly more verbose.
- Totally arbitrary.
- Utterly inconsistent (with anything).
- Confused and confusing.
- Completely out of keeping.
- Muddled and muddling.
- 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.
| [reply] [d/l] [select] |
|
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
| [reply] [d/l] [select] |
|
|
|
|
|
|
|
|
1) if there are links, explore them :) 2) make links obviou 3) hi
Basically, rjbs/d.golden really wanted it
| [reply] |
|
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.
| [reply] |
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. | [reply] |
Re^2: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20
by vkon (Curate) on Nov 24, 2013 at 16:11 UTC
|
| [reply] |
Re^2: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20
by ysth (Canon) on Dec 02, 2013 at 01:25 UTC
|
| [reply] |
|
| [reply] |
|
| [reply] |
|
|
|
Re^2: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20
by dmitri (Priest) 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. | [reply] |