Re: Undefine mixed data

[email protected] (Polgár Márton)
Newsgroups perl.perl6.users
Message-ID <VI1P195MB001486AADC9C7DB7A3983831FE819@VI1P195MB0014.EURP195.PROD.OUTLOOK.COM>
(Since this mail couldn't be delivered at first, I'll try to 
aggressively split it this time...)

Dear Ralph,

I'm sorry that you get frustrated but this is still for all intents and 
purposes a technical discussion so I don't think it does any good to be 
vocal about it. There are good points and bad points, arguments and 
counter-arguments. I can also get upset when I feel indifference or 
dishonesty in a response that's meant to be an argument but I think a 
thread like this should read like valuable technical content to an 
"outsider".

>> you cannot reasonably indicate for an array that it doesn't have
>> valid content, as opposed to being empty by chance
> If you mean indicate it's undefined, then here's one way:
> ```
> my @array;
> say @array.elems;      # 0
> say @array.so;         # False
> say @array.defined;    # True
>
> say @array := Array:U; # (Array:U)
> say @array.so;         # False
> say @array.defined;    # False
> ```
> If you mean something else, please be specific.
First, it's both inconsistent and inconvenient to have to explicitly 
bind the variable. Second, once you bound it to the undefined (and 
indefinite) value, you cannot store elements into it by assignment 
anymore (there is no auto-vivification either) - so at the end of the 
day, this is a very similar solution to giving up on @variables 
altogether, except here you give up on assignment altogether. However, 
if you want to modify a part of a composite data structure via a 
container (say, a value you retrieved using .values or some sort of 
mapping), binding won't help you; you just spoil your own reference to 
the data you wanted to alter. Again, something that works well for 
Scalars but nothing else.
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.