Re: Array as hash tables
rh wrote:[color=blue]
> "Richard Cornford" wrote:[/color]
<snip>[color=blue][color=green]
>> If you want to store key/value pairs without any restrictions to the
>> names perhaps you need to implement an object for that storage.[/color]
>
> That's unfortunate. Truthfully, this is a name-scope conflict with
> genesis imbedded as a deficiency of the language (a statement made
> notwithstanding the fact that JavaScript remains, by far, my favourite
> progamming language). It should be possible to obtain a basic object
> that is entirely clear of such name conflicts.
>
> Given that, and ever seemingly the contrarian, I don't believe that
> Alexis is that far off track in attempting to remedy the deficiency
> through removal of pre-definded values in the object. ...[/color]
We have seen that Mozilla is admitting to adding some non-standard
properties to its JS objects. I am fairly sure that I have also seen
some similar non-standard properties on Konqueror objects, as apparently
exposed implementation details (I don't have time to re-check right
now). That makes relying on blanking a list of expected properties
unsatisfactory, as it would be difficult to guarantee that the list was
comprehensive across JS implementations .
Adding a space to the front of the property names is not guaranteed to
be absolutely safe either, but the chances of coincidence are lower and
programmers are unlikely to make JS implementations that used space
prefixed property names (not least because most other languages would
not allow it).
Richard.
rh wrote:[color=blue]
> "Richard Cornford" wrote:[/color]
<snip>[color=blue][color=green]
>> If you want to store key/value pairs without any restrictions to the
>> names perhaps you need to implement an object for that storage.[/color]
>
> That's unfortunate. Truthfully, this is a name-scope conflict with
> genesis imbedded as a deficiency of the language (a statement made
> notwithstanding the fact that JavaScript remains, by far, my favourite
> progamming language). It should be possible to obtain a basic object
> that is entirely clear of such name conflicts.
>
> Given that, and ever seemingly the contrarian, I don't believe that
> Alexis is that far off track in attempting to remedy the deficiency
> through removal of pre-definded values in the object. ...[/color]
We have seen that Mozilla is admitting to adding some non-standard
properties to its JS objects. I am fairly sure that I have also seen
some similar non-standard properties on Konqueror objects, as apparently
exposed implementation details (I don't have time to re-check right
now). That makes relying on blanking a list of expected properties
unsatisfactory, as it would be difficult to guarantee that the list was
comprehensive across JS implementations .
Adding a space to the front of the property names is not guaranteed to
be absolutely safe either, but the chances of coincidence are lower and
programmers are unlikely to make JS implementations that used space
prefixed property names (not least because most other languages would
not allow it).
Richard.
Comment