develooper Front page | perl.perl6.users | Postings from November 2020

Re: The ,= operator

Thread Previous | Thread Next
From:
William Michels via perl6-users
Date:
November 29, 2020 21:31
Subject:
Re: The ,= operator
Message ID:
CAA99HCwVc3bHjvRvCGc4ogNBVq4GErpd-DsnWSwv7NiXzo3V_A@mail.gmail.com
On Sun, Nov 29, 2020 at 9:16 AM Joseph Brenner <doomvox@gmail.com> wrote:
>
> William Michels <wjm1@caa.columbia.edu> wrote:
> >> > "Perhaps more importantly, what improvement do you propose?"
> >
> > Apologies for top-posting, but what immediately comes to my mind upon
> > encountering the creation of a self-referential (circular/infinite)
> > object is proverbially 'going-down-a-level' and trying again. So I
> > tried 1. 'decontainerizing' the object on the LHS, and then 2. using
> > the ",=" postfix to add an additional element (or many). Nothing
> > worked.
>
> I think the trouble with ideas like that is once you accept that
>
>   @a ,= 'd';
>
> Is necessarily a short-form of:
>
>   @a = @a, 'd';
>
> You can see the thing you need to decontainerize is that @a on
> the RHS:
>
>   @a = | @a, 'd';
>
> But you can't get at it in the short form.
>
> (So you wouldn't normally try to use the short form with arrays.)

Hi Joe, what would you expect the code below to produce?

%h<> ,= c => 3;
@a[] ,= 'd';

Best, Bill.

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