Il 03/11/2022 14:46, Allin Cottrell ha scritto:
On Wed, 2 Nov 2022, Federico Fiorani wrote:
> Dear all,
> I noticed this thing.
>
> (gretl 2022c on Windows)
> <hansl>
> strings s = null
> s[""]
> </hansl>
>
> <output>
> ? strings s = null
> ? s[""]
> Index value 969423488 is out of bounds
>
> Error executing script: halting
>> s[""]
> </output>
>
> The number changes at every run. (maybe a memory address?)
No string (empty or otherwise) can be a valid index into an array (or
matrix, or string), so the example above should provoke a
non-conformable types error -- and now it does in git.
Thanks
However, a string in square brackets can be a valid accessor for a
bundle element, and equivocation over that point explains why the
error wasn't being caught correctly before.
> The same problem occurs with arrays and bundles
Hmm, I'm not seeing a problem with bundles. Even before today's fix I
was getting:
<hansl>
bundle b = null
b[""]
</hansl>
<output>
? bundle b = null
? b[""]
"": no such item
Terminated on error
</output>
which seems quite correct. What are you seeing with bundles?
Sorry, I expressed
ambiguously. I meant "bundles" type, array of bundles.
(gretl 2022c)
<hansl>
bundles bun = null
bun[""]
</hansl>
<output>
? bundles bun = null
? bun[""]
Index value 2094668032 is out of bounds
Error executing script: halting
bun[""]
</output>
Federico