On Sat, Mar 18, 2023 at 6:28 PM Polgár Márton
<polgar.mar...@windowslive.com> wrote:
>
> For what it's worth, I think most of these behaviors that sometimes
> even contradict each other (like the "freshly undefined" array being
> both .defined and .DEFINITE) are just design mistakes from a different time.

There are no mistakes here. There is no contradiction of the kind you suggest.

The design from a different time was great, and we're lucky enough to enjoy it.

But it took until a few years ago to deprecate the wrongly named
function `undefine`.

That's all. Please don't blow such a small thing up into something it's not.

> 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.

> it does no good, ever, that you get to store a Nil value ... in an array

Why do you think the `is default(Nil)` idiom for storing `Nil`s in `Scalar`s
is OK except when the `Scalar`s are inside an array?

I grant that, as jnthn put it in an SO discussing this:

> While there is the `is default(Nil)` trick, I'd strongly suggest using some
> other value as your sentinel. Trying to use a language feature in a
> situation where you don't want the primary behavior it exists to provide
> will generally not go smoothly.

So, it is not something most Rakoons are likely to ever want. But that's
the rule that proves the exception -- on rare occasions *some* Rakoons
*do* want to store a `Nil` in an array because it's not a sentinel but a
`Nil` representing a `Nil`.

For obvious reasons I'm not going to look for examples of this use in
`Array`s to share them in this thread. No matter how irritated I get about
what you write I would still want to give you a hug if I met you in RL, and
would ask that you just eat a hat or something.

----
love, ralph

Reply via email to