=pod =encoding utf8 =head1 NAME Muldis::D::Core::Types_Catalog - Muldis D catalog-defining data types =head1 VERSION This document is Muldis::D::Core::Types_Catalog version 0.25.0. =head1 PREFACE This document is part of the Muldis D language specification, whose root document is L; you should read that root document before you read this one, which provides subservient details. Moreover, you should read the L document before this current document, as that forms its own tree beneath a root document branch. =head1 DESCRIPTION This document contains one or more sections that were moved here from L so that that other document would not be too large. These core data types are more special-purpose in nature and are intended for use in defining or working with the system catalog. Those types that are nonscalar are completely defined types. Note that whenever an attribute of one of the tuple types isn't significant, given the context (determined by other attributes of the same type), and should be ignored, its value is the default for its type. Note that many of the tuple types might conceptually have C attributes, but those would actually be provided by any larger types in which they are embedded, rather than by these types themselves. I =head1 TYPE SUMMARY These system-defined subtypes are specific to defining the system catalog, more or less: sys.std.Core.Type.Universal sys.std.Core.Type.Empty sys.std.Core.Type.Scalar # The following are all regular ordered scalar types. sys.std.Core.Type.Cat.Name sys.std.Core.Type.Cat.NameChain sys.std.Core.Type.Cat.DeclNameChain sys.std.Core.Type.Cat.Comment sys.std.Core.Type.Tuple # The following are all regular tuple types. sys.std.Core.Type.Cat.FuncHead sys.std.Core.Type.Cat.UpdHead sys.std.Core.Type.Cat.ProcHead sys.std.Core.Type.Cat.FuncBody sys.std.Core.Type.Cat.UpdBody sys.std.Core.Type.Cat.ProcBody sys.std.Core.Type.Cat.InnerFuncBody sys.std.Core.Type.Cat.InnerUpdBody sys.std.Core.Type.Cat.InnerProcBody sys.std.Core.Type.Cat.ProcStmt sys.std.Core.Type.Cat.Type sys.std.Core.Type.Cat.Exception sys.std.Core.Type.Database # The following are all regular database types. sys.std.Core.Type.Cat.System sys.std.Core.Type.Cat.Federation sys.std.Core.Type.Cat.Depot sys.std.Core.Type.Cat.Package sys.std.Core.Type.Cat.ExprNodeSet sys.std.Core.Type.Relation # The following are all regular relation types. sys.std.Core.Type.Cat.SysNspSet sys.std.Core.Type.Cat.Sys(Func|Upd|Proc)Set sys.std.Core.Type.Cat.DepotMountSet sys.std.Core.Type.Cat.SubdepotSet sys.std.Core.Type.Cat.PackageSet sys.std.Core.Type.Cat.Dep(Func|Upd|Proc)Set sys.std.Core.Type.Cat.Pkg(Func|Upd|Proc)Set sys.std.Core.Type.Cat.Inner(Func|Upd|Proc)Set sys.std.Core.Type.Cat.ScaLitExprNodeSet sys.std.Core.Type.Cat.ScaPRLitExprNodeSet sys.std.Core.Type.Cat.TupLitExprNodeSet sys.std.Core.Type.Cat.RelLitExprNodeSet sys.std.Core.Type.Cat.FuncInvoExprNodeSet sys.std.Core.Type.Cat.MultiUpdStmt sys.std.Core.Type.Cat.NameTypeMap sys.std.Core.Type.Cat.NameExprMap sys.std.Core.Type.Cat.AttrRenameMap =head1 TYPES FOR DEFINING ENTITY NAMES AND COMMENTS =head2 sys.std.Core.Type.Cat.Name A C (scalar) is a canonical short name for any kind of DBMS entity (or named component) when declaring it; this short name is sufficient to identify the entity within its immediate namespace. Similarly, a DBMS entity can often be invoked or referred to using just its C, depending on the context; other times, a C must be used instead to also qualify the reference with a namespace. C is the same as C in representation (each value as a string of characters) and cardinality though its values are distinct; it is specifically intended for use in naming DBMS entities rather than being for general-purpose user data. The default value et al is as for C. =head2 sys.std.Core.Type.Cat.NameChain A C (scalar) is a canonical long name for invoking or referring to a DBMS entity, when its name needs to be qualified with a namespace. A C is conceptually a sequence of 2..N C, the 2..N elements being ordered from parent-most to child-most component name. A C has 2 system-defined possreps, named C and C, both of which are defined over C. The C possrep directly matches the conception of the type; it consists of 1 attribute whose name is the empty string; the attribute is a C whose C attribute has a declared type of C and that must have at least 2 elements. The C possrep consists of 1 attribute whose name is the empty string; the attribute is a C, its value being identical to when the elements of the first possrep are catenated (in order with the first element at the start of the string), with a period (C<.>) between the parts, and each part escaped such that backslashes, single-quotes, and periods are escaped as C<\b>, C<\q> and C<\p> respectively. The default and minimum value of C is a 2 element sequence where each element is the default value of C (the empty string); its maximum value is an infinite sequence where each element is the maximum value of C (an infinite-length string) and practically impossible. The cardinality of this type is infinity; to define a most-generalized finite C subtype, you must specify a maximum number of sequence elements of its values, and each element must be of a finite C subtype. =head2 sys.std.Core.Type.Cat.DeclNameChain A C (scalar) is mostly the same as a C but that it is a sequence of 0..N rather than 2..N, and that its C possrep has N+1 periods rather than N-1; the possrep starts with a period, and also has a period just following each sequence element, and so an empty sequence means a C possrep consisting of just a period. A C is used in declaring system catalogs where DBMS entities live under a potentially N-depth namespace, such as depot entities grouped in a subdepot hierarchy. The default and minimum value of C is a zero element sequence. =head2 sys.std.Core.Type.Cat.Comment A C (scalar) is the text of a Muldis D code comment, which programmers can populate as an attribute of several catalog data types, such as whole routines or statements or expression nodes. C is exactly the same as C in representation and cardinality though its values are distinct; it is intended just for commenting Muldis D code. One main intended use of this type is to help preserve comments in code translated to or from other languages; though only a subset of those (FoxPro?) keep comments in the AST rather than discarding them. The default value et al is as for C. =head1 TYPES FOR DEFINING SYSTEM-DEFINED ENTITIES =head2 sys.std.Core.Type.Cat.System A C is a C. It specifies the public interfaces of system-defined entities, specifically all the system-defined types, routines, and catalogs. Both standard system-defined entities and implementation-specific system-defined entities are specified here, specifically all the relcons and relvars with the names C<(sys|mnt|fed|dep|sdp|pkg).cat>. The system catalog constant named C is of the C type. A C has these 11 attributes: =over =item C - C This is an optional programmer comment about the collection of system-defined entities as a whole. =item C - C These are all the system-defined namespaces where DBMS entities may live, or that otherwise always exist due to being system-defined. Specifically, it declares these 27 standard language namespaces: C<.(sys|mnt|fed|dep|sdp|pkg|inn|lex).> (which have the nameless global root namespace as their parent, spelled C<.>, that isn't also declared here), C<.sys.(cat|std|imp).>, C<.mnt.cat.>, C<.(fed|dep|sdp|pkg).(cat|lib|data).>, C<.sys.std.Core.>, C<.sys.std.Core.Type.>, C<.sys.std.Core.Type.Cat.>; it also declares other C namespaces, and where applicable, standard extensions or implementation-specific extensions. =item C - C These are the interfaces of all the system-defined functions|updaters|procedures. =item C - C These are the few central system-defined data types that have special hard-coded meanings and are not defined like any other types. Specifically, it declares these 9 standard types (all in the C namespace): C, C, C, C, C, C, C, C, C. =item C - C These are all the system-defined (|quasi-)scalar root (not union etc) types that have no possreps, the likes of which users can not define, and values of which can only be selected using either system-defined literal syntax or mapping functions. Specifically, it declares these 7 standard types: in the C namespace, C, C, C, C, C; in the C namespace, C, C. =item C<(sca|non_sca|dom)_types> - C These are all the system-defined (|quasi-)scalar types with possreps, and complete (|quasi-)nonscalar types, and domain types. =item C - C These are the interfaces of all the catalog relcons and relvars. Specifically, it declares these 6 standard catalogs: C<(sys|mnt|fed|dep|sdp|pkg).cat>; the first is a relcon, the others not. =back The default value of C defines a system with zero builtins. =head2 sys.std.Core.Type.Cat.SysNspSet A C is a C that specifies the set of system namespaces that exist for organizing DBMS public entities, mostly the system-defined ones; these system namespaces are organized into a tree whose root has no name. A C only specifies that a system namespace exists, not which public entities it contains; see the C which contains it for that. A C has these 3 attributes: =over =item C - C This is the fully-qualified name, in the nameless global root namespace, of the system namespace's parent system namespace. =item C - C This is the declared name of the system namespace within the namespace defined by C; other Muldis D code would reference it with the combination of C and C. =item C - C This is an optional programmer comment about this specific system namespace. =back A C has a binary (unique) key on the C plus C attributes. Its default value is empty. =head2 sys.std.Core.Type.Cat.Sys(Func|Upd|Proc)Set A C is a C that specifies a set of system-defined functions|updaters|procedures. A C has these 4 attributes: =over =item C - C This is the fully-qualified name, in the nameless global root namespace, of the function|updater|procedure's parent system namespace. =item C - C This is the declared name of the function|updater|procedure within the namespace defined by C; other Muldis D code would reference it with the combination of C and C. =item C - C This is an optional programmer comment about the function|updater|procedure as a whole. =item C - C This defines the entire function|updater|procedure heading, that is its public interface sans the name, which is all the details of how to use it and no more detail than necessary about how it is implemented. =back A C has a binary (unique) key on the C plus C attributes. Its default value is empty. =head2 sys.std.Core.Type.Cat.SysSpecTypeSet A C is a C that specifies a set of system-defined types which are particularly special and unlike other types. A C has these 3 attributes: =over =item C - C This is the fully-qualified name, in the nameless global root namespace, of the type's parent system namespace. =item C - C This is the declared name of the type within the namespace defined by C; other Muldis D code would reference it with the combination of C and C. =item C - C This is an optional programmer comment about the type as a whole. =back A C has a binary (unique) key on the C plus C attributes. Its default value is empty. =head2 sys.std.Core.Type.Cat.SysScaNPRTypeSet A C is a C that specifies a set of system-defined (|quasi-)scalar root (not union etc) types that have no possreps. A C has these 4 attributes: =over =item C - C This is the fully-qualified name, in the nameless global root namespace, of the type's parent system namespace. =item C - C This is the declared name of the type within the namespace defined by C; other Muldis D code would reference it with the combination of C and C. =item C - C This is an optional programmer comment about the type as a whole. =item C - C This is C if the type is a quasi-scalar type; it is C if the type is a scalar type. =back A C has a binary (unique) key on the C plus C attributes. Its default value is empty. =head2 sys.std.Core.Type.Cat.Sys(Sca|NonSca|Dom)TypeSet A C is a C that specifies a set of system-defined scalar|nonscalar|domain types. A C has these 4 attributes: =over =item C - C This is the fully-qualified name, in the nameless global root namespace, of the scalar|nonscalar|domain type's parent system namespace. =item C - C This is the declared name of the scalar|nonscalar|domain type within the namespace defined by C; other Muldis D code would reference it with the combination of C and C. =item C - C This is an optional programmer comment about the scalar|nonscalar|domain type as a whole. =item C - C This defines the entire scalar|nonscalar|domain type sans the name. =back A C has a binary (unique) key on the C plus C attributes. Its default value is empty. =head2 sys.std.Core.Type.Cat.SysCatSet A C is a C that specifies a set of system-defined catalog dbvars; each tuple specifies one catalog dbvar. A C has these 4 attributes: =over =item C - C This is the fully-qualified name of the catalog dbvar. =item C - C This is an optional programmer comment about the catalog dbvar as a whole. =item C - C This is C if a catalog relcon is being described; it is C if a catalog relvar is being described. =item C - C This is the definition of the catalog dbvar. =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head1 TYPES FOR DEFINING FEDERATIONS =head2 sys.std.Core.Type.Cat.Federation A C is a C. It specifies a federation of depot mounts, that is, all the depot mounts that an in-DBMS process can see or update, and that defines the scope of an active transaction. There is exactly one of these per process and it doesn't have a name. The system catalog variable named C is of the C type. A C has these 2 attributes: =over =item C - C This is an optional programmer comment about the federation as a whole. =item C - C These are the depot mounts that comprise the federation. =back The default value of C has zero depot mounts. =head2 sys.std.Core.Type.Cat.DepotMountSet A C is a C that specifies a set of depot mounts, such that each tuple is a single depot mount. A depot mount is a named in-DBMS context by which a depot is referenced from either other depots or by the main application, and it also specifies the catalog content of the depot itself. A C has these 3 attributes: =over =item C - C This is the declared name of the depot mount; other Muldis D code would reference it with this name. =item C - C This is an optional programmer comment about this specific mount of the depot. =item C - C This defines the entire system catalog of the depot that this mount has made visible to the DBMS. =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head1 TYPES FOR DEFINING DEPOTS AND SUBDEPOTS =head2 sys.std.Core.Type.Cat.Depot A C is a C. It specifies the entire system catalog of a single depot, that is, the widest scope within which all entities must be fully defined in terms of just user-defined entities within the same scope or of system-defined entities. It also doubles to specify the system catalog of a subdepot, which is an arbitrary subset of a depot's entities that internally looks like a depot; a depot can have 0..N subdepots, and any that exist are arranged in a hierarchy with the depot as the root. The system catalog variables named C and C are both of the C type. A C has these 10 attributes: =over =item C - C This is an optional programmer comment about the (|sub)depot as a whole. =item C - C These are all the subdepots that this (|sub)depot contains. =item C - C These are all the packages that this (|sub)depot contains. =item C - C These are all the function|updater|procedure definitions that this (|sub)depot contains. =item C<(sca|non_sca|dom)_types> - C These are all the definitions that this (|sub)depot contains of (|quasi-)scalar types with possreps, and complete (|quasi-)nonscalar types, and domain types. =item C - C This is the definition of the dbvar that this (|sub)depot contains. =back The default value of C defines an empty (|sub)depot. =head2 sys.std.Core.Type.Cat.SubdepotSet A C is a C that specifies the set of subdepots that a depot might optionally have for organizing its public entities; these subdepots are organized into a tree whose root is the depot. A C only specifies that a subdepot exists, not which depot entities it contains; see the C which contains it for that. A C has these 3 attributes: =over =item C - C This is the fully-qualified name, in the C namespace, of the subdepot's parent subdepot, which is often just the depot itself. =item C - C This is the declared name of the subdepot within the namespace defined by C; other Muldis D code would reference it with the combination of C and C. =item C - C This is an optional programmer comment about this specific subdepot. =back A C has a binary (unique) key on the C plus C attributes. Its default value is empty. =head2 sys.std.Core.Type.Cat.PackageSet A C is a C that specifies the set of packages that a depot might optionally have for organizing its possibly private entities. A C has these 4 attributes: =over =item C - C This is the fully-qualified name, in the C namespace, of the packages's parent (|sub)depot. =item C - C This is the declared name of the package within the namespace defined by C; other Muldis D code would reference it with the combination of C and C. =item C - C This is an optional programmer comment about the package definition as associated with this package name. =item C - C This defines the entire system catalog of the package. =back A C has a binary (unique) key on the C plus C attributes. Its default value is empty. =head2 sys.std.Core.Type.Cat.Dep(Func|Upd|Proc)Set A C is a C that specifies a set of functions|updaters|procedures that a (|sub)depot might directly contain. A C has these 5 attributes: =over =item C - C This is the fully-qualified name, in the C namespace, of the function|updater|procedure's parent (|sub)depot. =item C - C This is the declared name of the function|updater|procedure within the namespace defined by C; other Muldis D code would reference it with the combination of C and C. =item C - C This is an optional programmer comment about the function|updater|procedure as a whole. =item C - C This defines the entire function|updater|procedure heading, that is its public interface sans the name, which is all the details of how to use it and no more detail than necessary about how it is implemented. =item C - C This defines the entire function|updater|procedure body, that is its implementation, besides what C defines. =back A C has a binary (unique) key on the C plus C attributes. Its default value is empty. =head2 sys.std.Core.Type.Cat.Dep(Sca|NonSca|Dom)TypeSet A C is a C that specifies a set of scalar|nonscalar|domain types that a (|sub)depot might directly contain. A C has these 4 attributes: =over =item C - C This is the fully-qualified name, in the C namespace, of the scalar|nonscalar|domain type's parent (|sub)depot. =item C - C This is the declared name of the scalar|nonscalar|domain type within the namespace defined by C; other Muldis D code would reference it with the combination of C and C. =item C - C This is an optional programmer comment about the scalar|nonscalar|domain type as a whole. =item C - C This defines the entire scalar|nonscalar|domain type sans the name. =back A C has a binary (unique) key on the C plus C attributes. Its default value is empty. =head1 TYPES FOR DEFINING PACKAGES =head2 sys.std.Core.Type.Cat.Package A C is a C. It specifies the entire system catalog of a single package, which provides a privatizing namespace for a subset of a depot's entities; entities outside a package can only invoke that package's entities which have been declared part of its public interface. A package internally looks like a depot but that it doesn't contain subdepots or other packages. The system catalog variable named C is of the C type. A C has these 8 attributes: =over =item C - C This is an optional programmer comment about the package as a whole. =item C - C These are all the function|updater|procedure definitions that this package contains. =item C<(sca|non_sca|dom)_types> - C These are all the definitions that this package contains of (|quasi-)scalar types with possreps, and complete (|quasi-)nonscalar types, and domain types. =item C - C This is the definition of the dbvar that this package contains. =back The default value of C defines an empty package. =head2 sys.std.Core.Type.Cat.Pkg(Func|Upd|Proc)Set A C is a C that specifies a set of functions|updaters|procedures that a package might contain, where each function|updater|procedure may be either public for the DBMS as a whole or private to the package. A C has these 5 attributes: =over =item C - C This is the declared name of the function|updater|procedure. =item C - C This is an optional programmer comment about the function|updater|procedure as a whole. =item C - C This is C if the function|updater|procedure is part of the package's own public interface and may be invoked from outside the package; it is C if it is just part of the package's internals. =item C - C This defines the entire function|updater|procedure heading, that is its public interface sans the name, which is all the details of how to use it and no more detail than necessary about how it is implemented. =item C - C This defines the entire function|updater|procedure body, that is its implementation, besides what C defines. =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head2 sys.std.Core.Type.Cat.Pkg(Sca|NonSca|Dom)TypeSet A C is a C that specifies a set of scalar|nonscalar|domain types that a package might contain, where each scalar|nonscalar|domain type may be either public for the DBMS as a whole or private to the package. A C has these 4 attributes: =over =item C - C This is the declared name of the scalar|nonscalar|domain type. =item C - C This is an optional programmer comment about the scalar|nonscalar|domain type as a whole. =item C - C This is C if the scalar|nonscalar|domain type is part of the package's own public interface and may be directly invoked from outside the package; it is C if it is just part of the package's internals. =item C - C This defines the entire scalar|nonscalar|domain type sans the name. =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head1 TYPES FOR DEFINING ROUTINE HEADINGS =head2 sys.std.Core.Type.Cat.FuncHead A C is a C. It specifies the entire heading or public interface of a function or inner function, except for its name and public/private status; the latter are provided by any type embedding this one when applicable. A C has these 3 attributes: =over =item C - C This is an optional programmer comment about the function heading. =item C - C This is the declared result data type of the function as a whole. =item C - C This is the declared parameter list of the function, which has 0..N named and typed parameters. =back The default value of C has zero parameters and a result type of C. =head2 sys.std.Core.Type.Cat.UpdHead A C is a C. It specifies the entire heading or public interface of an updater or inner updater, except for its name and public/private status; the latter are provided by any type embedding this one when applicable. A C has these 3 attributes: =over =item C - C This is an optional programmer comment about the updater heading. =item C - C This is the declared subject-to-update parameter list of the updater, which has 1..N named and typed such parameters. It must have at least 1 element. =item C - C This is the declared read-only parameter list of the updater, which has 0..N named and typed such parameters. =back There is a distributed (unique) key over the C attributes of C and C. The default value of C has 1 subject-to-update parameter whose name is C and whose declared type is C; it has zero read-only parameters. =head2 sys.std.Core.Type.Cat.ProcHead A C is a C. It specifies the entire heading or public interface of a procedure or inner procedure, except for its name and public/private status; the latter are provided by any type embedding this one when applicable. A C has these 3 attributes: =over =item C - C This is an optional programmer comment about the procedure heading. =item C - C This is the declared subject-to-update parameter list of the procedure, which has 0..N named and typed such parameters. =item C - C This is the declared read-only parameter list of the procedure, which has 0..N named and typed such parameters. =back There is a distributed (unique) key over the C attributes of C and C. The default value of C has zero parameters. =head1 TYPES FOR DEFINING ROUTINE BODIES =head2 sys.std.Core.Type.Cat.FuncBody A C is a C. It specifies the entire body or implementation of a function, besides the details that a C has, one of which each C typically must be paired with. A C has these 6 attributes: =over =item C - C This is an optional programmer comment about the function body. =item C - C This defines the entire main body of the function, namely what's left of the function body after parts of it are optionally factored out into inner routines or inner types. It must consist of a value expression whose result type is of the result type of the function, and which invokes all of the function's parameters. =item C - C These are all the inner function definitions that this function contains. =item C - C These are all the inner scalar|nonscalar|domain type definitions that this function contains. =back There is a distributed (unique) key over the C attributes of C. The default value of C directly corresponds to the default value of C and unconditionally results in the value C. =head2 sys.std.Core.Type.Cat.UpdBody A C is a C. It specifies the entire body or implementation of an updater, besides the details that a C has, one of which each C typically must be paired with. A C has these 7 attributes: =over =item C - C This is an optional programmer comment about the updater body. =item C - C This defines the entire main body of the updater, namely what's left of the updater body after parts of it are optionally factored out into inner routines or inner types. It must consist of a multi-update statement which invokes all of the updater's parameters. =item C - C These are all the inner updater definitions that this updater contains. =item C - C These are all the inner function definitions that this updater contains. =item C - C These are all the inner scalar|nonscalar|domain type definitions that this updater contains. =back There is a distributed (unique) key over the C attributes of C. The default value of C directly corresponds to the default value of C and unconditionally updates its C argument to the value C. =head2 sys.std.Core.Type.Cat.ProcBody A C is a C. It specifies the entire body or implementation of a procedure, besides the details that a C has, one of which each C typically must be paired with. A C has these 8 attributes: =over =item C - C This is an optional programmer comment about the procedure body. =item C - C This defines the entire main body of the procedure, namely what's left of the procedure body after parts of it are optionally factored out into inner routines or inner types. =item C - C These are all the inner procedure definitions that this procedure contains. =item C - C These are all the inner updater definitions that this procedure contains. =item C - C These are all the inner function definitions that this procedure contains. =item C - C These are all the inner scalar|nonscalar|domain type definitions that this procedure contains. =back There is a distributed (unique) key over the C attributes of C. The default value of C directly corresponds to the default value of C and is a no-op, having zero statements. =head2 sys.std.Core.Type.Cat.Inner(Func|Upd|Proc)Set A C is a C that specifies a set of inner functions|updaters|procedures that a function|updater|procedure might contain. A C has these 4 attributes: =over =item C - C This is the declared name of the inner function|updater|procedure. =item C - C This is an optional programmer comment about the inner function|updater|procedure as a whole. =item C - C This defines the entire inner function|updater|procedure heading, that is its public interface sans the name, which is all the details of how to use it and no more detail than necessary about how it is implemented. =item C - C This defines the entire inner function|updater|procedure body, that is its implementation, besides what C defines. =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head1 TYPES FOR DEFINING INNER ROUTINE BODIES =head2 sys.std.Core.Type.Cat.InnerFuncBody A C is a C. It specifies the entire body or implementation of an inner function (or the main body of a function), besides the details that a C has, one of which each C typically must be paired with. A C has these 2 attributes: =over =item C - C This is an optional programmer comment about the (|inner )function body. =item C - C This defines the value expression tree that comprises the entire (|inner )function body. =back There is a distributed (unique) key over the C attributes of all the attributes of C; and if this C is paired with a C, then the distributed key also extends over the head's parameter names. A C specifies a simple value expression tree of named expression nodes, each of which is a tuple of one of its C attributes. It must have at least 1 member node, except that it may have zero member nodes iff the (|inner )function it is composed into has exactly 1 parameter, in which case the value expression tree implicitly results in the argument to said parameter. Otherwise: All member nodes must define a simple expression node tree, such that every member except one (which is the root node) has one of its peers as a parent node, and no direct cycles between members are permitted (only indirect cycles based on (|inner )function invocations are allowed); the name of the root node must be the empty string. Note that the composed-into (|inner )function's parameters are also implicitly tree nodes, and are referenced by name into the expression the same way as any other named expression node is. Regardless of whether the node count is zero or 1+, the tree must denote a value expression whose result type is of the result type of the (|inner )function it is composed into, and which invokes all of the (|inner )function's parameters. The default value of C directly corresponds to the default value of C and unconditionally results in the value C. =head2 sys.std.Core.Type.Cat.ExprNodeSet A C is a C that specifies a set of named value expression nodes. It is typically composed into a (|inner )(function|updater). Each tuple of a C attribute is a named expression node, which is the majority component of functional Muldis D code. All arbitrarily complex Muldis D expression trees, including relational queries, are composed of just expression nodes, either directly, or indirectly by way of (|inner )function invocations, as each (|inner )function body is itself composed entirely of a single expression tree (of at least 1 node). Only functions and updaters may contain expression nodes, so for any procedures that would conceptually include them, those portions of the procedures need to be separated out and encapsulated by named (|inner )functions or (|inner )updaters. Note that, while the general case has expression trees simply denoting a value, in some cases they may instead define a pseudo-variable / virtual variable; that only happens in (|inner )updaters where the expression is used as an argument for a subject-to-update parameter of an (|inner )update operator call; in that case the leaf nodes / only node of the expression must map to a subject-to-update parameter of the containing (|inner )update operator. A C has these 5 attributes: =over =item C - C These are expression nodes that define scalar literals of types such that the Muldis D dialect provides special literal syntax specific to the type, and the type may not have any possreps. =item C - C These are expression nodes that define (|quasi-)scalar literals of types such that each type has at least 1 possrep, and each literal is specified simply in terms of possrep attributes. =item C - C These are expression nodes that define (|quasi-)tuple literals. =item C - C These are expression nodes that define (|quasi-)relation literals. =item C - C These are expression nodes that invoke (|inner )functions. =back There is a distributed (unique) key over the C attributes of all of a C's attributes. Its default value is empty. =head2 sys.std.Core.Type.Cat.ScaLitExprNodeSet A C is a C that specifies a set of value expression nodes where each node is a hard-coded scalar literal of one of a certain collection of system-defined core scalar types (or subtype thereof). A C has these 3 attributes: =over =item C - C This is the declared name of the expression node. =item C - C This is an optional programmer comment about the expression (leaf) node. =item C - C This is the actual literal value that the expression node represents. I =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head2 sys.std.Core.Type.Cat.ScaPRLitExprNodeSet A C is a C that specifies a set of value expression nodes where each node represents a (|quasi-)scalar literal of a type that has at least 1 possrep, and the literal is specified simply in terms of possrep attributes. A C has these 6 attributes: =over =item C - C This is the declared name of the expression node. =item C - C This is an optional programmer comment about either the expression node or the expression node (sub-)tree it is the root of. =item C - C This is C if the node denotes a quasi-scalar literal; it is C if the node just denotes a scalar literal. =item C - C This is the name of the type that the (|quasi-)scalar value belongs to. =item C - C This is the name of the possrep, of the type named by C, in terms of whose attributes the (|quasi-)scalar value is being selected. =item C - C These are the attributes (names and values) of the C possrep of the (|quasi-)scalar literal. =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head2 sys.std.Core.Type.Cat.TupLitExprNodeSet A C is a C that specifies a set of value expression nodes where each node represents a (|quasi-)tuple literal. A C has these 4 attributes: =over =item C - C This is the declared name of the expression node. =item C - C This is an optional programmer comment about either the expression node or the expression node (sub-)tree it is the root of. =item C - C This is C if the node denotes a quasi-tuple literal; it is C if the node just denotes a tuple literal. =item C - C These are the attributes (names and values) of the (|quasi-)tuple literal. =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head2 sys.std.Core.Type.Cat.RelLitExprNodeSet A C is a C that specifies a set of value expression nodes where each node represents a (|quasi-)relation literal. A C has these 5 attributes: =over =item C - C This is the declared name of the expression node. =item C - C This is an optional programmer comment about either the expression node or the expression node (sub-)tree it is the root of. =item C - C This is C if the node denotes a quasi-relation literal; it is C if the node just denotes a relation literal. =item C - C These are the names of all of this (|quasi-)relation literal's attributes. =item C - C These are the (|quasi-)tuples of the (|quasi-)relation literal. =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head2 sys.std.Core.Type.Cat.FuncInvoExprNodeSet A C is a C that specifies a set of value expression nodes where each node represents the result of invoking a named (|inner )function with specific arguments. A C has these 4 attributes: =over =item C - C This is the declared name of the expression node. =item C - C This is an optional programmer comment about either the expression node or the expression node (sub-)tree it is the root of. =item C - C This is the name of the (|inner )function being invoked. =item C - C These are the arguments for the (|inner )function invocation. Each element defines one argument value, with the element C matching the invoked (|inner )function's parameter name, and the element C naming another local expression node which defines the value. =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head2 sys.std.Core.Type.Cat.InnerUpdBody A C is a C. It specifies the entire body or implementation of an inner updater (or the main body of a updater), besides the details that a C has, one of which each C typically must be paired with. A C has these 3 attributes: =over =item C - C This is an optional programmer comment about the (|inner )updater body. =item C - C This defines the expression trees that are arguments to the update operators that C invokes. These expression trees must reference all of the parameters that the inner update operator has. =item C - C This defines the entire body of the (|inner )updater, which is composed of a single multi-update statement. This multi-update statement must reference all of the parameters that the (|inner )updater has. =back There is a distributed (unique) key over the C attributes of all the attributes of C; and if this C is paired with a C, then the distributed key also extends over the head's parameter names. The default value of C directly corresponds to the default value of C and unconditionally updates its C argument to the value C. =head2 sys.std.Core.Type.Cat.MultiUpdStmt A C is a C that specifies a multi-update statement (of 1..N variables), which is the narrowest scope implicitly atomic component of procedural Muldis D code. It is the most fundamental component of procedural Muldis D code. The variables being updated are accessed via the host (|inner )updater's subject-to-update parameters. All arbitrarily complex Muldis D value assignments, including relational assignments, are composed of just C, either directly, or indirectly by way of (|inner )updater invocations, as each (|inner )updater body is itself composed entirely of 1 multi-update statement (plus supporting value expressions). Only (|inner )updaters may contain C, so for any procedures that would conceptually include them, those portions of the procedures need to be separated out and encapsulated by named (|inner )updaters. Each tuple of a multi-update statement is a single update statement, which represents a single invocation of an (|inner )updater, and at least 1 tuple is required. A C has these 4 attributes: =over =item C - C This is an optional programmer comment about the single update statement as a whole. =item C - C This is the name of the (|inner )updater being invoked. =item C - C These are the 1..N subject-to-update arguments to the (|inner )updater invocation, as-per C. But since each expression tree in C is binding to a subject-to-update parameter, the expression tree actually is defining a pseudo-variable / virtual-variable over 1..N containing routine subject-to-update parameters; in the most trivial (and common) case, the parameter is referenced directly. =item C - C These are the 0..N read-only arguments to the (|inner )updater invocation. Each element defines one argument value, with the element C matching the invoked routine's parameter name, and the element C naming a local expression node (or parameter) which defines the value. =back There is a distributed (unique) key over the C attributes of C and C. The default value of C directly corresponds to the default value of C and unconditionally updates its containing (|inner )updater's C argument to the value C. =head2 sys.std.Core.Type.Cat.InnerProcBody A C is a C. It specifies the entire body or implementation of an inner procedure (or the main body of a procedure), besides the details that a C has, one of which each C typically must be paired with. A C has these 3 attributes: =over =item C - C This is an optional programmer comment about the (|inner )procedure body. =item C - C This defines the 0..N (non-parameter) lexical variables of the (|inner )procedure; they initialize to the default values of their declared types. =item C - C This defines the entire main body of the (|inner )procedure, which is composed of 0..N procedure statements. These statements must reference all of the parameters and lexical variables that the (|inner )procedure has. =back There is a distributed (unique) key over the C attributes of all the attributes of C; and if this C is paired with a C, then the distributed key also extends over the head's parameter names. The default value of C directly corresponds to the default value of C and is a no-op, having zero statements. =head2 sys.std.Core.Type.Cat.ProcStmt A C is a C. It specifies a generic statement from which non-implicitly-atomic procedural Muldis D code is composed. Only (|inner )procedure may contain C. A C has these 4 attributes: =over =item C - C This is an optional programmer comment about the statement as a whole. =item C - C Every procedure statement is an invocation of some other procedural routine (eg, procedure, update operator, system service), either user-defined or system-defined; this is the name of that routine. =item C - C These are the 0..N subject-to-update arguments to the routine invocation, as-per C. =item C - C These are the 0..N read-only arguments to the routine invocation. Each element defines one argument value, with the element C matching the invoked routine's parameter name, and the element C naming a local or global variable or statement-containing routine parameter which defines the value. =back There is a distributed (unique) key over the C attributes of C and C. The default value of C will invoke C, giving it arguments from same-named and typed parameters. =head1 TYPES FOR DEFINING DATA TYPES =head2 sys.std.Core.Type.Cat.(Scalar|Nonscalar|Domain)Type A C is a C. Its purpose is as per C, one of which it is a wrapper for along with other inner types that are composed into it. A C has these 6 attributes: =over =item C - C This is an optional programmer comment about the type as a whole. =item C - C This defines the actual main type, which a C is just a wrapper for, namely what's left of the updater body after parts of it are optionally factored out into inner routines or inner types. =item C - C These are all the inner scalar|nonscalar|domain type definitions that this type contains. =item C - C These are all the inner function definitions that this type contains. =back There is a distributed (unique) key over the C attributes of C. The default value of C is as per C. =head2 sys.std.Core.Type.Cat.Inner(Sca|NonSca|Dom)TypeSet A C is a C that specifies a set of inner scalar|nonscalar|domain types that a function|updater|procedure or scalar|nonscalar|domain type might contain. A C has these 3 attributes: =over =item C - C This is the declared name of the inner scalar|nonscalar|domain type. =item C - C This is an optional programmer comment about the inner scalar|nonscalar|domain type as a whole. =item C - C This defines the entire inner scalar|nonscalar|domain type sans the name. =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head1 TYPES FOR DEFINING INNER DATA TYPES =head2 sys.std.Core.Type.Cat.InnerScalarType A C is a C. It defines either a new (|quasi-)scalar root type with at least 1 possrep, or it defines a subtype of some other (|quasi-)scalar type which also adds at least one possrep to the other type. Either way, every possrep defines a candidate representation that can handle every value of the (|sub)type it is defined with, and the Muldis D implementation may choose for itself which of these, or some other alternative, is the actual/physical representation. A C has these 6 attributes: =over =item C - C This is an optional programmer comment about the (|quasi-)scalar (|sub-)type as a whole. =item C - C Iff the type being defined is a (|quasi-)scalar root type, then C is not applicable and is a C. Iff the type being defined is a subtype of some other (|quasi-)scalar type, then C is a C whose sole element is the name of that other type. Note that any type named by C must itself have at least 1 possrep. =item C - C Iff the type being defined is a (|quasi-)scalar root type, then C is a C whose sole element is C if the type is a quasi-scalar type; the element is C if the type is a scalar type. Iff the type being defined is a subtype of some other type, then C is not applicable (would be redundant) and is a C. =item C - C These are the 1..N possrep definitions that comprise this type such that each one fully defines a set of attributes plus restrictions on their collective values whereby it defines a representation of all values of this type. Note that if multiple (|quasi-)scalar types are related to each other such that more than one declares possreps for at least one common value, then the C attribute of the C attributes of all of those types' definitions have a distributed (unique) key over them. I
=item C - C When this type has more than one possrep applicable to all of its values, these are the definitions of mapping functions for deriving the representation of a value in one possrep directly from the representation in another possrep, and also directly in the reverse. Every one of this type's possreps must be mapped bidirectionally to every other one of its possreps, either directly or indirectly. So for C

total possreps, the total number of bidirectional maps C is in C<< (P-1) <= M <= ((P-1)*P/2) >>. When a subtype is adding possreps to an other base type, all of the mapping functions are defined with the subtype. =item C - C This defines the entire (main) body of a function that results in the default (|quasi-)scalar value of the (|sub-)type; it has zero parameters and its result type is the same as the (|quasi-)scalar type whose declaration it is part of. =back The default value of C defines a scalar root type with a single possrep whose name is the empty string and that has no attributes; it is a singleton type, whose default value is its only value. =head2 sys.std.Core.Type.Cat.PossrepSet A C is a C that specifies a set of possreps that a (|quasi-)scalar (|sub-)type might consist primarily of. A C has these 4 attributes: =over =item C - C This is the declared name of the possrep. =item C - C This is an optional programmer comment about the possrep as a whole. =item C - C This defines the 0..N attributes of the possrep. =item C - C This defines the entire (main) body of a C function that determines what combinations of possrep attribute values denote values of the (|sub-)type, besides the restrictions imposed by the declared types of the attributes individually. The implicit function heading that this goes with has a single C parameter whose declared type is a tuple whose attributes match those declared by C and whose argument denotes the value to test; the function's implicit result type is C. If the function unconditionally results in C, then all possible combinations of attribute-allowable values are collectively allowed. =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head2 sys.std.Core.Type.Cat.PossrepMapSet A C is a C such that each tuple in it specifies a pair of mapping functions to bidirectionally derive a value of a type between 2 of its possreps. A C has these 5 attributes: =over =item C - C This is an optional programmer comment about this bidirectional mapping. =item C - C This is the declared name of one possrep. =item C - C This is the declared name of a second possrep. The value of C must be distinct from that of C, and moreover, the 2 values must be mutually ordered so that the value of C is before the value of C; the latter constraint defines a C's canonical form. =item C - C This defines the entire (main) body of a mapping function that derives the representation of the possrep named by C from that of the possrep named by C. The implicit function heading that this goes with has a single C parameter whose declared type is a tuple whose attributes match those of C; the function's implicit result type is a tuple whose attributes match those of C. Note that every distinct argument (domain) value of this function must have a distinct result (range) value. =item C - C This defines the entire (main) body of the inverse mapping function to that of C. I =back A C has a binary (unique) key on the C plus C attributes. Its default value is empty. =head2 sys.std.Core.Type.Cat.InnerNonscalarType A C is a C. It defines either a new (|quasi-)nonscalar heading (set of attributes) with associated constraints for a tuple and relation type having that heading, or it defines a subtype of some other (|quasi-)nonscalar type. That is, it defines 2 new data types, a tuple type and a relation type with matching headings. Note that you also declare a database type using C, by declaring a tuple type whose attributes are all relation or database typed. Note that you can not use a C to declare or subtype an incomplete type, as it (or its supertype) must specify a complete set of attributes. A C has these 10 attributes: =over =item C - C This is an optional programmer comment about the (|quasi-)nonscalar (|sub-)type as a whole. =item C - C Iff the type being defined is a (|quasi-)nonscalar root type, then C is not applicable and is a C. Iff the type being defined is a subtype of some other (|quasi-)nonscalar type, then C is a C whose sole element is the name of that other type. =item C - C Iff the type being defined is a (|quasi-)nonscalar root type, then C is a C whose sole element is C if the type is a quasi-nonscalar type; the element is C if the type is a nonscalar type. Iff the type being defined is a subtype of some other type, then C is not applicable (would be redundant) and is a C. =item C - C Iff this is C then the type being defined is primarily considered a tuple type; that is, when either the type name is referenced normally (not using the C namespace), or the type definition is embedded (and nameless), then it is simply considered to be a tuple type; iff this is C then the type being defined is primarily considered to be a relation type. When a type is primarily considered a tuple or relation type, the only way to reference it as the other kind of type is by using the C referencing syntax. =item C - C Iff the type being defined is a (|quasi-)nonscalar root type, then C defines the 0..N attributes of the type. Iff the type being defined is a subtype of some other type, then the parent type's attribute list is used by default, but C of the current type may be used to apply additional constraints by overriding the declared types of a subset of the parent's attributes with types that are subtypes of the originals; an override is done using matching C attribute values of C. It is indeed valid for a (|quasi-)nonscalar type to have zero attributes; in this case, a tuple type consists of exactly one value, and a relation type consists of exactly two values. =item C - C These are the 0..N explicit (unique) keys that are applicable to relation values of the type being defined; they apply either as candidate keys or as unique key constraints, depending on context. If there are no explicit keys, then there is an implicit (unique) key over all attributes of the relation type being defined, meaning that every possible tuple that may individually be an element of a relation value of the type being defined, may be in it at once. If any explicit keys are defined, then every one must be over a distinct proper subset of the type's attributes, and moreover no key's attributes may be a proper subset of any other key's attributes; if 2 such candidates appear, just use the one that has the subset. It is valid for a key to consist of zero attributes; in this case, that key is the only key of the type, and values of the type may each consist of no more than one tuple. Note that C is logically a short-hand syntax (the canonical simplest form) for a particular kind of C of the type being defined, one that compares the cardinality of a projection of a relation on its key attributes with the cardinality of the original relation; the attributes are a key if the cardinalities are equal. =item C - C This defines the entire (main) body of a C function that determines what combinations of tuple attribute values denote values of the (|sub-)type, besides the restrictions imposed by the declared types of the attributes individually; it is a generalized type constraint that validates a tuple as a whole. The implicit function heading that this goes with has a single C parameter whose declared type is a tuple whose attributes match those declared by C and whose argument denotes the value to test; the function's implicit result type is C. If the function unconditionally results in C, then all possible combinations of attribute-allowable values are collectively allowed. This function is invoked either once to test a tuple value, or multiple times to individually test every tuple in a relation value. =item C - C This is like C but that the function's parameter is relation-typed rather than tuple-typed; it is a generalized type constraint that validates a relation as a whole. =item C - C This defines the entire (main) body of a function that results in the default (|quasi-)tuple value of the (|sub-)type; it has zero parameters and its result type is the same as the (|quasi-)tuple type whose declaration it is part of. =item C - C This defines the entire (main) body of a function that results in the default (|quasi-)relation value of the (|sub-)type; it has zero parameters and its result type is the same as the (|quasi-)relation type whose declaration it is part of. =back The default value of C defines a relation type that is the same as C, having zero attributes, whose default value is the one with zero tuples. =head2 sys.std.Core.Type.Cat.KeySet A C is a C that specifies a set of candidate keys or unique key constraints for a relation type; each tuple specifies one candidate key. A C has these 4 attributes: =over =item C - C This is the declared name of the key. =item C - C This is an optional programmer comment about the key as a whole. =item C - C This defines the 0..N host relation attributes comprising the key. If this set is empty, then we have a nullary key which restricts the host relation to have a maximum of 1 tuple. =item C - C This is C if all of the attributes comprising this key are likely to be treated as immutable in practice for the relation's tuples, and hence are the best candidates for identifying tuples within a relation over an extended term, and are the best mapping values for automatic new foreign keys and join conditions if the host relation type has to be auto-split into several associated ones, for example because the physical representation of this relation doesn't support RVAs. This concept is a generalization of the concept of "the primary key" of a relation. A relation type can have either none of its keys or more than one of its keys with a true C attribute. This is C if any of the attributes comprising this key are likely to mutate and so shouldn't be used as the target of generated foreign keys. =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head2 sys.std.Core.Type.Cat.InnerDomainType A C is a C. It defines a new data type whose values are all drawn from one or more specified other types (which can be any types at all), and that generally speaking it is an arbitrary subset of C (and it has its own default value). The value set of the new data type is determined by taking a set of source types' values and subtracting from it a set of filter types' values, then applying a type constraint function to the values remaining. The two likely most common such type definition scenarios are defining a simple restriction/domain type over a single scalar source type (no possreps added) using a filter function, and defining a simple explicit union type of 2+ scalar source types. A domain type does not define any changes or supplements to the interfaces available for working with its values, instead simply using those of its declared parent types. A data type defined in this way is typically not considered to exist when the system wants to determine the MST (most specific type) of one of its values. A C has these 7 attributes: =over =item C - C This is an optional programmer comment about the inner domain type as a whole. =item C - C These are the names of the 0..N other types that all the values of the new data type are drawn from; the complete set of source values is determined by either unioning (the default) or intersecting the values of these types. =item C - C Iff this is C then the set of source data types will be intersected to determine the complete set of source values, and if C has no elements then the source set is just C; iff this is C then the set of source data types will be unioned to determine the complete set of source values, and if C has no elements then the source set is just C. =item C - C These are the names of the 0..N other types (which are generally subtypes of those of C) that determine values which the new data type will I contain; the complete set of filter values is determined by either intersecting (the default) or unioning the values of these types. =item C - C Iff this is C then the set of filter data types will be unioned to determine the complete set of filter values, and if C has no elements then the filter set is just C; iff this is C then the set of filter data types will be intersected to determine the complete set of filter values, and if C has no elements then the filter set is just C. =item C - C This defines the entire (main) body of a C function that determines what filter-type-passing source-type values are part of the domain type. The implicit function heading that this goes with has a single C parameter whose declared type is C, unless there is exactly 1 C element whereupon the declared type is the same as the source type, and whose argument is the value to test; the function's implicit result type is C. If the function unconditionally results in C, then all filter-type-passing values are allowed. =item C - C This defines the entire (main) body of a function that results in the default value of the subtype; it has zero parameters and its result type is the same as the domain type whose declaration it is part of. =back The default value of C defines an alias for C, with the same default value; the C is that type, C is unconditionally C. =head1 TYPES FOR DEFINING DBVARS =head2 sys.std.Core.Type.Cat.DbVar A C is a C. It specifies the data type and transition constraints and so forth of a database-typed variable, such as the C<(dep|sdp|pkg).data> variables. A C has these 2 attributes: =over =item C - C This is an optional programmer comment about the dbvar as a whole. =item C - C This defines the entire database type. =back I The default value of C defines a variable that is "just a database" and has no extra constraints. =head1 SIMPLE GENERIC CATALOG COLLECTION TYPES =head2 sys.std.Core.Type.Cat.NameTypeMap A C is a C. It defines a basic component list, meaning a set of names, with a declared data type name for each. It forms the foundation for most componentized type definitions, including all tuple and relation types (for which it is named I), and it is used also for the components list of a scalar possrep. It is also used to define parameter lists for routines. A C has 2 attributes, C (a C) and C (a C); the C is the declared name of the attribute or parameter, and comprises a unary key; the C is the declared data type of the attribute or parameter. Its default value has zero tuples. =head2 sys.std.Core.Type.Cat.NameExprMap A C is a C. It defines a basic component-values list, meaning a set of names, with a declared local expression node (or parameter or variable) name for each. It is used to define collection literals; one C defines a whole C value. It is also used to define argument lists for routine invocations. A C has 2 attributes, C (a C) and C (a C); the C is the name of the tuple/etc attribute or routine argument, and comprises a unary key; the C is the declared local name of the expression node (or parameter or variable) which defines the value for the attribute or argument. Note that while the C attribute could conceivably just be a C because most of its allowed values would be in the C namespace, the C is used instead so that value expressions can take advantage of terse syntax for addressing value attributes. Its default value has zero tuples. =head2 sys.std.Core.Type.Cat.AttrRenameMap A C is a C. It is used as a specification for how to rename attributes of some collection. A C has 2 attributes, C and C, each of those being a C, and each of those being a unary key. Its default value has zero tuples. =head1 SEE ALSO Go to L for the majority of distribution-internal references, and L for the majority of distribution-external references. =head1 AUTHOR Darren Duncan (C) =head1 LICENSE AND COPYRIGHT This file is part of the formal specification of the Muldis D language. Muldis D is Copyright © 2002-2008, Darren Duncan. See the LICENSE AND COPYRIGHT of L for details. =head1 TRADEMARK POLICY The TRADEMARK POLICY in L applies to this file too. =head1 ACKNOWLEDGEMENTS The ACKNOWLEDGEMENTS in L apply to this file too. =cut