Re: Undefine mixed data

[email protected] (Fernando Santagata)
Newsgroups perl.perl6.users
Message-ID <CAJ+jyGg3iZQFw1w5390NLtd+FQN_WERrQdwSSxz_OHiEvFYnVg@mail.gmail.com>
Hi,

I don't know if I understood your question correctly; I tried two
alternative ways to assign Nil using the REPL:

[0] > my ($a, @b, %c, &d)
((Any) [] {} (Callable))
[1] > [$a, @b, %c, &d] »=» Nil
[(Any) [] {} (Any)]
[2] > say "{$a.^name} {@b.^name} {%c.^name} {&d.^name}"
Any Array Hash Callable
[2] > [$a, @b, %c, &d].map: { $_ = Nil }
((Any) (Any) (Any) (Any))
[3] > say "{$a.^name} {@b.^name} {%c.^name} {&d.^name}"
Any Array Hash Callable

On Tue, Mar 14, 2023 at 4:42 AM rir <[email protected]> wrote:

>
>     undefine seen at:
>       <unknown file>, line 1
>     Will be removed with release v6.e!
>     Please use another way: assign a Nil; for Arrays/Hashes, assign Empty
> or () instead.
>
> Will that deprecation require a conditional and two assignments
> for mixed data?
>
> [$a, @a, $b, %c, $c, &d].map: { .&undefine};
>
> [$a, @a, $b, %c, $c, &d].map(
>     { $_ = $_ ~~ (Associative,Positional).any ?? Empty !! Nil });
>


-- 
Fernando Santagata
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.