develooper Front page | perl.perl5.porters | Postings from July 2020

Re: So are refaliasing and declared_refs stable?

Thread Previous | Thread Next
From:
Eric Brine
Date:
July 23, 2020 23:49
Subject:
Re: So are refaliasing and declared_refs stable?
Message ID:
CALJW-qG52DHeHsyLfOvOoKT3vtrg7HC7YmQ0mCaQcmdd4_hnSw@mail.gmail.com
On Tue, Jul 21, 2020 at 3:41 PM Alexander Hartmaier <
alex.hartmaier@gmail.com> wrote:

> I wonder why the postfix dereferencing syntax isn't used for a new
> features as that's newer and thus preferred way of dereferencing: my @a->@*
> = [];
> Is this even allowed? I guess not.
>

@a->@* means @{ @a }, which makes no sense.

1) It would be a strict refs error as you attempt to dereference a number,
except it doesn't even get that far.

2) Even if you used something legal on the LHS of the ->@*, this could
never work. Assigning to an array,  whether using @a = ... or $ref->@* =
..., already has a different meaning.

Dereferencing is the opposite of what's appropriate here. So it's not a
question which dereferencing syntax is or should be supported.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About