VK said:
Nothing helpful I can do for you besides copy my sample
again:
var myArray = new Array();
];
If you still do not see why the term "jagged" has been
coined then I'm really out of further ideas.
The reason for using the term 'jagged' (or the alternative 'ragged') has
never been questioned. This thread exists because when you said (and
repeated) "JavaScript Array is dynamic, jagged, sparse" you were
applying the term 'jagged' to something that is incapable of exhibiting
jaggedness; the javascript Array.
No amount of definitions of a 'jagged array' that effectively state that
a jagged array is something that a javascript Array is not will make the
term applicable to a javascript Array. And no number of examples of code
that can be described as a 'jagged array' but represent structures that
are not a javascript Array will convince anyone (except you) either.
Most people don't make the mistake of trying to transfer the qualities
of a construction onto its component parts.
Consider the implications of this notion of transferring a label for a
structure (no matter how appropriate that label may appear for that
structure) to its building blocks. By analogy, and using an archetypal
building block; the house brick: A house brick might be characterised as
'a normally rectangular block of ceramic', and it may be used to build
various sorts of structures, one of which might be appropriately
labelled 'a perimeter barrier around a property' (i.e. a garden wall).
The same logic that labels an array of arrays as a 'jagged array' and
then uses that to justify 'jagged' in "JavaScript Array is dynamic,
jagged, sparse" would also have a house brick characterised as 'a
normally rectangular block of ceramic, a perimeter barrier around
property'. This is not sound reasoning. When component parts are
distinct form the construction the ability to make the construction does
not imbue the components with the qualities of that construction.
And this style of reasoning is doubly poor because the same components
can be used to construct many things for which mutually exclusive labels
are appropriate. This is true of house bricks, which might be used to
create structures that may be labelled 'internal walls', 'paving' and so
on. The house brick could not have all of these qualities at the same
time. And this is particularly true of objects in a programming language
that is capable of emulating anything. Would it be reasonable to
characterise the javascript Object as 'a dynamic collection of
name/value pairs, interface to web services and an XML parser' because
it is possible to use it to create structures that could reasonably be
labelled 'an interface to web services' or an 'XML parser'? Obviously
not.
If you are going to characterise a javascript Array you should be saying
something that is true of javascript Arrays. Either true of all
javascript Arrays or potentially true of all javascript Arrays, and it
is impossible for any javascript Array to exhibit jaggedness so the term
'jagged cannot be appropriately used to characterise javascript Arrays.
This is the crux of the question of the appropriateness of 'jagged' as a
characterisation of the javascript Array; either a (any) javascript
Array instance can be shown to exhibit jaggedness or the term is not
applicable. And as the impossibility of a javascript Array exhibiting
jaggedness has been logically proven nothing short of code demonstrating
this 'impossible phenomenon' would modify the obvious conclusion that
you are incorrect to attempt to apply the tem 'jagged' as a
characterisation of the javascript Array.
That maybe not the best term to use, but
not always the best terms are going into
programming vocabulary.
How appropriate the term may be for an array of arrays is not relevant
when characterising something that is not an array of arrays.
To foreign readers:
jagged
1. raggedly notched; sharply irregular on the surface
or at the borders.
(Random House Webster, 1998, New York)
<snip>
And Randy's question was "how can something that is linear in form be
"jagged"?". We are agreed that the javascript array is not
multi-dimensional and presumably agree that it has a dimension, so it
must have just one dimension. Anything that has just one dimension can
reasonable be described as 'linear', but a straight line does not have a
sharply irregular surface or borders. So how can the single dimensional
javascript array be reasonably characterised as 'jagged'?
Actually it was already answered right away why it
is *not* multi-dimensional array.
<snip>
Someone wanting to label the structure that is an array of differently
sized arrays as a 'jagged array' should be able to state a good reason
when they don't what to label an array of identically sized arrays as a
multi-dimensional array. So far you have never made such a statment.
Recall that one of the definitions of a 'jagged array' that you posted
read; "We are using the term "jagged array" to describe a
multi-dimensional array that is not necessarily rectangular", and if a
'jagged array' is an array of arrays and a 'jagged array' is a
multi-dimensional array that is not necessarily rectangular it is
difficult to see how an array of arrays can avoid being labelled a
multi-dimensional array by these definitions of a 'jagged array'.
Richard.