Skip to content

Commit 62a94bb

Browse files
committed
Rewrite the final 'nominal?' section based on Rossberg's comment
1 parent a85fe11 commit 62a94bb

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

design/mvp/Explainer.md

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -996,25 +996,19 @@ In summary: all type constructors are *structural* with the exception of
996996
bound are *abstract (resource) types* and follow the standard introduction and
997997
elimination rules of universal and existential types.
998998

999-
Lastly, since "nominal" is sometimes intended to mean "the opposite of
1000-
structural", a valid question is whether any of this is "nominal typing".
1001-
Unfortunately, "nominal" has a fuzzy meaning in modular contexts like the
1002-
Component Model where there is [necessarily](../high-level/Choices.md) no
1003-
shared global namespace. Instead, the main use cases for nominal types are
1004-
independently addressed by the addition of abstract and generative types
1005-
mentioned above. In particular, while importing or exporting an abstract type
1006-
allows a name to be assigned to a type that is visible to the outside world,
1007-
this name is ultimately just a *parameter name* or a *field name*, resp., whose
1008-
linkage to the outside world is entirely controlled by the component's
1009-
immediate parent (which can be another component). Note that a common
1010-
assumption concerning "nominal" types is that "the same name means the same
1011-
thing everywhere" which is definitely *not* the case for resource types but
1012-
*is* the case for *structural* types like `string` and `list`. See also the
1013-
explanation [below](#import-and-export-definitions) of how the URL field of
1014-
`externname` can be used by a component to name the semantic contract it
1015-
*expects* of imports or *claims* for exports. This naming of a contract with
1016-
a URL meant to have a global meaning is "nominal" in spirit but independent of
1017-
the type system.
999+
Lastly, since "nominal" is often taken to mean "the opposite of structural", a
1000+
valid question is whether any of the above "nominal typing". Inside a
1001+
component, resource types act "nominally": each resource type definition
1002+
produces a new local "name" for a resource type that is distinct from all
1003+
preceding resource types. The interesting case is when resource type equality
1004+
is considered from *outside* the component, particularly when a single
1005+
component is instantiated multiple times. In this case, a single resource type
1006+
definition that is exported with a single `externname` will get a fresh type
1007+
with each component instance, with the abstract typing rules mentioned above
1008+
ensuring that each of the component's instance's resource types are kept
1009+
distinct. Thus, in a sense, the generativity of resource types *generalize*
1010+
traditional name-based nominal typing, providing a finer granularity of
1011+
isolation than otherwise achievable with a shared global namespace.
10181012

10191013

10201014
### Canonical Definitions

0 commit comments

Comments
 (0)