in reply to Re^3: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20
in thread use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20
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;
|
|---|