It just happens that in JavaScript object literals (or dictionaries in early Python) are used to represent structured data. I would say that the term tends surface in contexts (or serialization formats) that are structurally typed rather than nominally typed.
Two kind-type? values are equal whenever the names, field counts, etc. of the types they describe are equivalent. That is, kind-type? values are compared using structural equality. The term shape of a type or simply shape, refers to a kind-type? value.
"shape" seems to be primarily used in contexts where structured data is represented by a collection of key/value pairs where order doesn't necessarily matter. Compare that to a C struct which specifies memory layout so order does matter and "structure" implies a more rigid organization. Though both terms are used in a rather informal manner.
A particular type is expected at each particular element position.
The element position serves as the implicit "key"
The element itself is the "value".
Order matters as the key is coupled to the position so a tuple would have shape and structure.
In the context of class-based objection orientation "shape" sometimes refers to the public interface while "structure" also reveals the internal organization.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
"shape" is a much looser concept than that.
It just happens that in JavaScript object literals (or dictionaries in early Python) are used to represent structured data. I would say that the term tends surface in contexts (or serialization formats) that are structurally typed rather than nominally typed.
For example in the Clojure spec guide:
From the Racket rebellion documentation:
"shape" seems to be primarily used in contexts where structured data is represented by a collection of key/value pairs where order doesn't necessarily matter. Compare that to a C
struct
which specifies memory layout so order does matter and "structure" implies a more rigid organization. Though both terms are used in a rather informal manner.Note that when arrays are used as tuples (wikipedia):
they could manifest a shape.
Order matters as the key is coupled to the position so a tuple would have shape and structure.
In the context of class-based objection orientation "shape" sometimes refers to the public interface while "structure" also reveals the internal organization.