Indexing array(string-indexables) with a string works, indexing array(non-string-indexables) does not. I don't see how that is a problem, but maybe my pragmatism is broken.
(String-indexables being mappings and, likely, any kind of objects.)
/ Johan Sundström (Achtung Liebe!)
Previous text:
16753605 2008-09-01 16:04 /40 lines/ Brevbäraren Recipients: Pike (-) ticket import Subject: Indexing the empty array with a string should MAYBE throw, or perhaps it should never throw? [4574]
Product: Pike Version: 7.7 Component: Compiler Reporter: peter@bortas.org URL: https://community.roxen.com/crunch/show_bug.cgi?id=4574
array a = ({}); a->apa;
(1) Result: ({ })
a = ({ "banan" });
(2) Result: ({ /* 1 element */ "banan" })
a->apa;
Expected integer as string index, got "apa". HilfeInput:1: HilfeInput()->___HilfeWrapper()
a = ({ "banan":(["a":1]) });
Compiler Error: 1:Missing '}'. Compiler Error: 1:syntax error, unexpected ':', expecting ')' Compiler Error: 1:syntax error, unexpected '}', expecting TOK_LEX_EOF or ';'
a = ({ (["banan":(["a":1])]) });
(3) Result: ({ /* 1 element */ ([ /* 1 element */ "banan": ([ /* 1 element */ "a": 1 ]) ]) })
a->banan;
(4) Result: ({ /* 1 element */ ([ /* 1 element */ "a": 1 ]) })
This seems a bit inconsistent.
(16753605) /Brevbäraren/--------------------------------------------
pike-devel@lists.lysator.liu.se