qt4cg / qtspecs

QT4 specifications
https://qt4cg.org/
Other
28 stars 15 forks source link

Common name for maps & arrays #1457

Open ChristianGruen opened 1 month ago

ChristianGruen commented 1 month ago

Past thoughts:

Copied from Michael:

It would be great if we could agree on a collective term for "maps and arrays". "Structured item" feels too generic to me. I've toyed with terms like "tabulation", "tabula", "composition", "dataset", "compendium", "aggregate". Perhaps "combo"? It's best to have a word that stands out from the crowd if we can't find one whose meaning is self-explanatory.

ChristianGruen commented 1 month ago

Would “combo” be an alias for somewhat like “structured combination of values”? Could work.

“Structured item” was (inter alia) inspired by C’s struct keyword.

MarkNicholls commented 1 month ago

in dotnet they are both considered to be 'Collections' but there are obviously many others too

gimsieke commented 1 month ago

“marrays”

michaelhkay commented 1 month ago

Most generic terms such as "collection" would naturally include sequences.

Advantages of "combo":

Disadvantages:

gimsieke commented 1 month ago

aola: associative or linear array

Arithmeticus commented 1 month ago

Every "item is either a node, a function, or an atomic item." (DM40) So isn't the common term function?

A reader would be forgiven for being confused on this point. 2.2 Basic Concepts unpacks nodes and items, but does not provide the same service for functions. Plus 2.9.5 Map Items and 2.9.6 Array Items are coordinate to 2.9.4 Function Items, as if the definition of item should have read "An item is either a node, a function, a map, an array, or an atomic item.'

A reader has to get all the way down to a note in 2.6 Sequences before the specs ever state that arrays and maps are function items. Shouldn't the reader first encounter that sentence not in a late note but much earlier, as part of the main text at 2.2 Basic Concepts?

It sounds like we're trying to cut up the concept of functions into two different subclasses, and give them names. I feel like the concept of function needs to be clarified first.

Arithmeticus commented 1 month ago

I find it significantly interesting that nowhere in the DM specs is the word "object" used.

Not that I'm suggesting it be used for maps and arrays. I was just surprised and wanted to note that observation for the record.

ndw commented 1 month ago

I'm trying to imagine some prose.

The first argument to the fn:spoon() function is a combo.

vs.

The first argument to the fn:spoon() function is a map or array.

I'm not sold on "combo". (I'm not wholly sold on the idea that we need a single term for the combination of a map or an array, but...)

A quick skim through a thesaurus doesn't turn up any useful synonyms for "map" and no synonms for "map" that are common with synonyms for "array".

For "array" we get some possibly useful terms. Of them "assortment" seems among the best.

ChristianGruen commented 1 month ago

Every "item is either a node, a function, or an atomic item." (DM40) So isn't the common term function?

The challenge (in my point of view) is to find a common term that excludes functions that are no arrays and no maps, such that we can say things like “an XYZ is a valid input for the lookup operator”.

It sounds like we're trying to cut up the concept of functions into two different subclasses, and give them names.

True. In the (far) future, the map&array category could contain other structures like ordered maps or sets.

michaelhkay commented 1 month ago

It sounds like we're trying to cut up the concept of functions into two different subclasses, and give them names.

We could call them intensional and extensional functions.

ChristianGruen commented 1 month ago

I'm not sold on "combo". (I'm not wholly sold on the idea that we need a single term for the combination of a map or an array, but...)

I counted the numbers of “map...array” occurrences in the specifications directory…

//text()[matches(normalize-space(), 'array.{1,10}map|map.{1,10}array')]

…and I got an impressive number of 66 results, which I believe could indicate that a dedicated term may be helpful. It includes cases like:

array, map
arrays and maps
arrays or maps
map keys and array index values
map nor an array
map or an array
map or array
map, or array
maps and and arrays
maps and arrays
maps or arrays
maps, and arrays
michaelhkay commented 1 month ago

I'm leaning towards "aggregate".

MarkNicholls commented 1 month ago

to me an aggregate implies potential heterogenous parts, and if it doesn't, why doesn't it include sequence?

if you ask chatgpt what the generally accepted term is it says "collection" and gives various examples, javascript, java, c# etc.

If you talk about collection classes in dotnet, I immediately assume it doesn't automatically include arrays, because arrays are foundational, there is no 'class Array', personally I think a similar principle can be applied here and use the generally accepted term, otherwise I wouldn't bother.

michaelhkay commented 1 month ago

We already have collections in the data model, so that name isn't available.

MarkNicholls commented 1 month ago

ah, ok...and that I assume does include sequences? "non sequence collectons"....but that's longer than "map and array".

The target audience is often the semi ignorant (like me), so its important that it does at least hint at a sensible/generally accepted meaning without needing to check it by looking it up.

"map and array" wins for me.

ChristianGruen commented 1 month ago

I'm leaning towards "aggregate".

I like this term better than »Combo«. »Container« could be yet another alternative.

At the moment, it may »just« be a matter of naming. In the longer term, it will be easier not to lose sight of the big picture: We could have numerous other data structures that share properties with maps and arrays.

gimsieke commented 1 month ago

“item structure” (as opposed to a document / node structure)

dnovatchev commented 1 month ago

I thought on this for long.

One word is much more precise than the rest. It is also short:

struct

Meaning "structured value" - obviously having meaning and needed for non-nodes only.

benibela commented 1 month ago

JSONiq called them json-item

And it had structured-item meaning maps, arrays, or nodes

michaelhkay commented 3 days ago

A struct to me means a record (I think it's Algol 68 terminology).

I think "structure" would work.

ChristianGruen commented 3 days ago

I think "structure" would work.

I think it could be a term that many would agree with (in the discussion, we had structured item, item structure and struct).

dnovatchev commented 3 days ago

A struct to me means a record (I think it's Algol 68 terminology).

I think "structure" would work.

"structure" is too-general and has different meanings that could be confused with each other. Structure of a molecule, structure of the Earth, topological structure, ..., etc.

I proposed "struct" because this avoids the above ambiguity.

Also, there is already "struct" in C, which is the closest thing to maps, and this would be easy to understand for anyone having some programming experience.

ChristianGruen commented 3 days ago

I proposed "struct" because this avoids the above ambiguity.

Yes, that has also been my initial proposal. As structs in C have keys and values, I think it would be confusing to name our arrays structs. Structure is more general.