ECMAscript already tried this. Bad idea.
If your hash keys happen to look like large numbers (e.g. you have 7-digit product codes) as soon as you store one of them, it says: "Oh, this looks like a number, so we'll store it like an array" and happily creates a million empty array entries for you. ~ John Williams On Tue, 28 Jan 2003 [EMAIL PROTECTED] wrote: > > This may sound like a silly idea but ... > > Has anyone considered removing with the syntactic distinction between > numeric and string indexing -- that is, between array and hash lookup? > > In particular, it would seem that > > %foo[$key] > > would be just as easy for the compiler to grok as > > %foo{$key} > > but would mean that we could stop worrying about the precedence of > postfix/infix "{", and things like > > if %test { $count++ } > > would not require whitespace before the "{" to be disambiguated. > > I don't have a complete solution as anonymous array and hash construction would > still need different syntaces, but has anyone else thought about this? > > - Martin > >