Randy said:
Richard Cornford said the following on 2/18/2006 1:04 PM:
That same reasoning can be applied to "jagged array",
"hash array", and "multi-dimensional array".
Yes it can, if a construct has been created to implement such concepts
then using such terms as a way of conveying some characteristic of the
construct is quite acceptable. Doing so may not absolutely precise and
may risk introducing wrong associations but it can also be a useful
shortcut to the rapid communication of ideas.
And this entire thread (or most of it anyway) has been spent
on whether JS has a "jagged array" or not.
As I have already said; if javascript can emulate anything then in one
sense it 'has' everything. Trying to apply that definition of javascript
'having' something would most likely inhibit an understanding of what
the javascript language is. A much more reasonable demarcation of what
javascript 'has' would be based on what 'is' by virtue of the nature
language as opposed to what can only be as a result of a construction or
emulation in javascript.
Of your short list only 'hash array' can be applied to something in
javascript without the need for a construction/emulation, as javascript
Objects do have qualities that resemble HashTables, etc. You may recall
that in the past reasonable arguments have been made in favour of
characterising javascript Objects as 'associative arrays' and
'HashTables'. I don't favour those usages as they do seem to directly
result in miss-associations where people expect the javascript Object to
be initially empty, support truly arbitrary keys and (with 'associative
array') have a - length - property that has a relationship with keys
used. But it is also undeniably the case that a value can be stored in a
javascript Object with a property name that can then be used as a key
for the retrieval of that value in the same way as a HashTable may be
used (there a just a stack of caveats that make drawing the parallel
insufficient as an explanation of the javascript Object).
You can't have it both ways
And I don't need to. This thread has been about whether it is
appropriate to apply the term 'jagged' to the javascript Array, in the
way that the terms 'dynamic' and 'sparse' can be applied to them.
Arguing that many labels can reasonably be applied to many things even
when those labels do not precisely describe the thing to which they are
attached, when those labels communicate something useful about the
object to which they are attached, is not inconstant with questioning
the applicability of a label to an object that is incapable of
exhibiting the quality named by the label. The javascript Array is
incapable of exhibiting 'jaggedness' so there can be no sense in which
it could be appropriate to characterise the javascript Array as
'jagged'.
The observation that it is possible to create, with javascript,
structures that may reasonably be labelled 'jagged arrays' or, for that
matter, 'multi-dimensional arrays' or 'trees' or 'maps' or whatever,
does not alter the nature of what the javascript Array is and so does
not make it reasonable to apply those labels to it.
So you don't have problems with "jagged array", a "hash array"
nor a "multi-dimensional array" with respect to Javascript as
long as the a is lowercase?
I don't have a problem labelling a structure that satisfies the broad
definition of what an array is as an 'array', and arrays of arrays,
implemented in javascript often satisfy that definition (and javascript
Arrays also satisfy that definition). But because javascript has an
Array constructor with an upper case 'A' it is often felt that using the
upper case 'A' (at least away form the initial letter of a sentence) in
Array should be read as a statement about the special objects of the
type created with the Array constructor. That is; 'Array' should be used
as the name of the type of javascript object and 'array' used to assert
the quaintly of arrayness.
Objects and structures that do not exhibit 'arrayness', and objects that
may exhibit it but only by coincidence (such as trees), probably should
not be labelled as 'arrays'.
OK, then it is *not* a "two-dimensional array" as JS doesn't
possess one.
It is not a two-dimensional Array as javascript Arrays are
single-dimensional. It is a structure than exhibits arrayness and has
two-dimensions (at lest it has two dimensions if you are looking at its
arrayness, if you were looking at its treeness then any number of
dimensions are irrelevant).
Again, you can't have it both ways. It is either a cat
or a dog, not both
With a javascript construct what something is depends quite a lot on why
it was created. It could have been created to act as a
'multi-dimensional array', a 'jagged array' or a 'tree'. The same
structure could be any of them so it is up to the author to decide which
concept(s) were intended. Having decided what the concept being
implemented is a set of labels become appropriate to be used to talk
about the qualities of the structure created.
Otherwise, VK is going to bookmark this post and anytime he
says JS has a Jagged/Hash/Multi-Dimensional array and you
say it doesn't, he is going to point back here and say "A
concise expression of something is not necessarily limited
to a literal description of its structure."
VK has already convinced himself that he has won this argument, instead
of just making himself look like an irrational half-whit, so what he may
do in the future will likely be as irrational and irrelevant as his
posts here.
I can see it, and name it. ;-)
Richard.