[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: typeof() creates elements in an array
From: |
arnold |
Subject: |
Re: typeof() creates elements in an array |
Date: |
Wed, 29 Sep 2021 07:32:23 -0600 |
User-agent: |
Heirloom mailx 12.5 7/5/10 |
"Andrew J. Schorr" <aschorr@telemetry-investments.com> wrote:
> > Which language in the manual, please?
>
> I was referring to the language he originally cited:
>
> " Normally, passing a variable that has never been used to a built-in
> function causes it to become a scalar variable (unassigned). However,
> 'isarray()' and 'typeof()' are different; they do not change their
> arguments from untyped to unassigned."
x[0] is an array element, not a variable. :-)
It's a subtle distinction, and yes, the language above should be
clarified and expanded.
> I'm not asserting that this could be handled differently, but the
> language above does say that the type of an unused "variable" won't be
> determined by calling typeof. So the question then becomes whether x[0]
> is a "variable" and whether the mere act of passing x[0] to typeof
> constitutes "using" it. One might argue that in an ideal world, x[0]
> would have an untyped value after that code snippet; I don't know whether
> that's possible.
It may in fact be possible. I'd need to trace the path through the
code to be sure.
> In either case, with respect to your example, the length of an untyped
> or unassigned value should be 0, even if scalar vs array hasn't been
> determined, no?
Yes, but that's a side point. length() was just a convenient example.
> I suspect that this is simply impossible to do any other way, since the
> array lookup for a non-existent value looks like it has to create a new
> entry with a NODE value, and so I guess that has to have an explicit type
> at that moment. I don't think we have a notion of an untyped Node_val.
We have Node_var_new, which is pretty close.
I will look at this when I get a few minutes.
Arnold
- typeof() creates elements in an array, Ivo Palli, 2021/09/27
- Re: typeof() creates elements in an array, david kerns, 2021/09/28
- Re: typeof() creates elements in an array, Andrew J. Schorr, 2021/09/28
- Re: typeof() creates elements in an array, arnold, 2021/09/29
- Re: typeof() creates elements in an array, Andrew J. Schorr, 2021/09/29
- Re: typeof() creates elements in an array,
arnold <=
- Re: typeof() creates elements in an array, arnold, 2021/09/30
- Re: typeof() creates elements in an array, Andrew J. Schorr, 2021/09/30
- Re: typeof() creates elements in an array, arnold, 2021/09/30
- Re: typeof() creates elements in an array, Andrew J. Schorr, 2021/09/30
Re: typeof() creates elements in an array, arnold, 2021/09/29