Scott Walters skribis 2004-04-14 13:12 (-0700): > Second, autovivication is impossible for the same reason. We can't tell > from parsing this lone expression whether baz should be converted to numbers > or strings automatically.
I want ` for hashes in the first place. Having it for arrays too would be nice, but it isn't as important to me. Having seen some international keyboard layouts, I think others may find not having to type [] very useful. Autovivification of elements is not a problem for pure hashes and arrays. Autovivification of references (as in "my $ref; $ref`aoeu") and elements of hybrid arrayhashes (like $0) is also not a problem if you use the ^-?\d+$ rule to decide. Again: if you need to be explicit, you still can. So I'm not sure where it is a problem. Even if deciding based on the value isn't good and for autovivification you default to hashes, the ` would still be a welcome addition. > If you can't remember what a data structure looks like, it doesn't matter if > the code spells out the sequences of hash-array-hash each time - you're > going to spell it out wrong. People new to Perl and new to data structures > have this problem all the time - they can't keep straight what the data structure > *is*. That, and not many hashes have \d+ keys. When they do, you can just use {} to make sure things are interpreted the way you want them to be. > actually go one further and coopt the . operator and emulate JavaScript more > closely, but I admit the visual distinction between method calls and subscripts > might warrent the noise. It's not just the visual distinction, but also to let the parser know. If I understand correctly, hashes and arrays will have many methods of their own. I don't want %hash.keys to be interpreted as %hash{'keys'} and I do want to be able to use the easier syntax when my hash does in fact have a key 'keys'. Juerd