=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.33.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 nonscalar 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.OrdDetFuncNameChain sys.std.Core.Type.Cat.DeclNameChain sys.std.Core.Type.Cat.Comment sys.std.Core.Type.Cat.Order 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.Type sys.std.Core.Type.Cat.InnerScalarType sys.std.Core.Type.Cat.InnerNonscalarType sys.std.Core.Type.Cat.InnerUnionType sys.std.Core.Type.Cat.InnerRestrType sys.std.Core.Type.Cat.DbVar sys.std.Core.Type.Cat.IfThenMap sys.std.Core.Type.Database # The following are all regular database types. sys.std.Core.Type.Cat.System sys.std.Core.Type.Cat.MountControlCat 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.Cat.StmtNodeSet sys.std.Core.Type.Cat.InnerTypeSet 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.SysSpecTypeSet sys.std.Core.Type.Cat.SysScaNPRTypeSet sys.std.Core.Type.Cat.SysTypeSet sys.std.Core.Type.Cat.SysCatSet sys.std.Core.Type.Cat.MountControlSet 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.DepTypeSet sys.std.Core.Type.Cat.Pkg(Func|Upd|Proc)Set sys.std.Core.Type.Cat.PkgTypeSet 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.IfElseExprNodeSet sys.std.Core.Type.Cat.GivenWhenDefExprNodeSet sys.std.Core.Type.Cat.(Func|Proc|Type)RefLitExprNodeSet sys.std.Core.Type.Cat.OrdDetFuncRefLitExprNodeSet sys.std.Core.Type.Cat.MultiUpdStmt sys.std.Core.Type.Cat.LeaveStmtNodeSet sys.std.Core.Type.Cat.CompoundStmtNodeSet sys.std.Core.Type.Cat.ProcInvoStmtNodeSet sys.std.Core.Type.Cat.IfElseStmtNodeSet sys.std.Core.Type.Cat.GivenWhenDefStmtNodeSet sys.std.Core.Type.Cat.IterateStmtNodeSet sys.std.Core.Type.Cat.LoopStmtNodeSet sys.std.Core.Type.Cat.Inner(Sca|Nonsca|Uni|Restr)TypeSet sys.std.Core.Type.Cat.PossrepSet sys.std.Core.Type.Cat.PossrepMapSet sys.std.Core.Type.Cat.VirtualAttrMapSet sys.std.Core.Type.Cat.ConstraintSet sys.std.Core.Type.Cat.KeySet sys.std.Core.Type.Cat.DistribKeySet sys.std.Core.Type.Cat.DKMemRelAttrMap sys.std.Core.Type.Cat.DKRelAttrKeyAttrMap sys.std.Core.Type.Cat.ForeignKeySet sys.std.Core.Type.Cat.ForeignDistribKeySet sys.std.Core.Type.Cat.FKChildAttrParentAttrMap sys.std.Core.Type.Cat.NameTypeMap sys.std.Core.Type.Cat.NameExprMap sys.std.Core.Type.Cat.NameDNCMap sys.std.Core.Type.Cat.AttrRenameMap sys.std.Core.Type.Cat.WhenThenMap These system-defined subtypes can never be used as components of a system catalog, or any database, but they may be used temporarily at runtime: sys.std.Core.Type.Universal sys.std.Core.Type.Empty sys.std.Core.Type.QuasiScalar # The following are special-purpose quasi-scalar types. sys.std.Core.Type.Cat.FuncRef sys.std.Core.Type.Cat.ProcRef sys.std.Core.Type.Cat.TypeRef sys.std.Core.Type.Cat.OrdDetFuncRef =head1 SIMPLE GENERIC SCALAR TYPES =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. The C type has a default ordering algorithm; it is the same 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 an 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. The C type has a default ordering algorithm; for 2 distinct C values, their order is determined as follows: 1. Eliminate any identical parent-most sequence elements as those alone would make the chains compare as same (if the remainder of both strings was the empty chain, then the chains are identical). 2. Iff the remainder of just one chain is the empty chain, then that chain is ordered before the non-empty one. 3. Compare the first element of each of the chain remainders; the chain with the first remaining element that is ordered first as per its own algorithm (that of C) is ordered before the other chain. =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. The C type has a default ordering algorithm; it is the same as for C. =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. The C type has a default ordering algorithm; it is the same as for C. =head2 sys.std.Core.Type.Cat.Order A C (order determination) is a scalar enumeration consisting of the 3 values C, C, C. When some context (such as within a list sort or range check operation) needs to know the relative order of 2 values according to some criteria, it can invoke a function that applies that criteria to those 2 values, which are its main/only arguments, and that function results in a C value for the context to make use of. A C has 2 system-defined possreps, named C and C. The C possrep directly matches the conception of the type as an enumeration of 3 character string values; it consists of 1 C-typed attribute whose name is the empty string. The C possrep consists of 1 C-typed attribute whose name is the empty string and whose value must be one of [C<-1>, C<0>, C<1>]; the 3 values of each possrep correspond in the same order as they are documented here. The default value of C is C; its minimum and maximum values are, respectively, C and C. The cardinality of this type is 3. The C type has a default ordering algorithm; C is ordered before C, and C before C. =head2 sys.std.Core.Type.Cat.OrdDetFuncNameChain The C type is defined as a non-proper / identical subtype of the C type that has a different default value, which is C rather than C<.>. This type is conceptually intended for use as the declared type of a routine parameter that would take the name of an C function, but that parameter is optional and should default to the system-defined scalar ordering function when no argument is given to it. =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 9 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 - C These are all the system-defined (|quasi-)scalar types with possreps, and complete (|quasi-)nonscalar types, and union types, and restriction 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.SysTypeSet A C is a C that specifies a set of system-defined 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 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 defines the entire 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 MOUNT CONTROLS =head2 sys.std.Core.Type.Cat.MountControlCat A C is a C. It specifies the control interface for mounting and unmounting (and creating and deleting) depots within the current in-DBMS process. The scope of these controls includes specifying what name the depot is mounted with, whether the mount is readonly vs updateable, or is temporary vs persistant, and implementation specific details like storage file names or network login credentials. Updates to this catalog have side-effects in what other user-updateable catalogs exist, making them appear or disappear. This catalog may only be updated when the current process has no active transaction. 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 depot mount control catalog as a whole. =item C - C These are the controls for the current depot mounts. =back The default value of C has zero depot mount controls. =head2 sys.std.Core.Type.Cat.MountControlSet A C is a C that specifies a set of controls per depot mounts, such that each tuple is a single control for a depot mount, and each depot mount has 1 mount control. Inserting a tuple will result in either an existing depot being mounted or a new depot being created (if possible) and mounted; updating a tuple will change some details of that depot mount's status, such as making it readonly or updateable; deleting a tuple will result in a mounted depot being either unmounted or unmounted plus deleted (if possible). A C has these 7 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 is C if the depot mount is for a transient depot that would automatically be created when mounted I automatically be deleted when unmounted, because it is only intended for use as the application's current working memory, and its maximum lifetime is the lifetime of the in-DBMS process. This is C (the default) if the depot mount is for a depot that either should already exist before being mounted, I that should continue to exist after being unmounted, because it is intended for persistent data. Note that the C status is orthogonal to whether the depot's storage is in volatile memory (eg, RAM) or in stable memory (eg, on disk); a I depot is simply one that is meant to be reusable by multiple depot mounts or processes. The C status may not be updated on an existing depot mount control. I =item C - C This is C if the depot mount must represent a depot that was newly created at the time the depot mount was created, where the depot creation is a direct side-effect of the mount operation. This is C (the default) if the depot being mounted must already exist without the mounting process having any hand in creating it. Note that there is no option provided to conditionally create a depot depending on whether it already exists, as a perceived safety feature (this detail is subject to change); to get that behaviour, first try creating the depot mount control with this attribute C, and if that fails due to nonexistence, then try again with it set to C. This attribute is ignored / not applicable when C is true. =item C - C This is C if the depot should be deleted at the same time it is unmounted, that is, when this depot mount control tuple is deleted. This is C (the default) if the depot should not be deleted as part of the unmount process. This attribute is ignored / not applicable when C is true. =item C - C This is C if the depot mount will permit the current in-DBMS process to make any kind of update to the depot, such as data manipulation, data definition, or creating/deleting it. This is C (the default) if the depot mount is only providing readonly access to the depot. When a depot mount is readonly, any attempt to update the depot through it will throw a runtime exception. The C attribute may be set to C at any time (when there is no active transaction), but it may only be set to C at the time the depot is mounted; this is for safety, such that if a depot mount won't let you update the depot now, there's no way it will let you update it later, save by unmounting and remounting the depot (the result of which is a different depot mount). Note that the C status is orthogonal to the depot locking mechanism; it won't block any other process from reading or updating that depot, so unless you have locks on the depot using some other means, it may still be updated by others while mounted readonly for you, so consistent reads between distinct statements outside of transactions are not guaranteed. I =item C
- C These are the 0..N other miscellaneous details that define this depot mount control. Each tuple in C
specifies an implementation-specific attribute name and (scalar) value. Example such implementation-specific details include the name of a local file that the depot is stored as, or the name of a DBMS server on the network plus authentication credentials to connect to it with. See each Muldis D implementation for details. Note that C
generally corresponds to the Perl DBI's concept of a data source name or connection string. But C
can also have other details like customizations on how to map a foreign DBMS' concepts to native Muldis D equivalents, or maybe information on where to find extra meta-data that has such info, or info to instruct a Muldis D interface to fill in functionality missing in the actual depot of a less capable DBMS, like constraints or stored invokable routines. =back A C has a unary (unique) key on the C attribute. Its default value is empty. It also has a transition constraint that prevents changing some attributes of a depot mount control once set. Note that the 3 attributes [C, C, C] may be merged into a single enumerated-typed attribute or otherwise be reorganized. =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 8 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 - C These are all the definitions that this (|sub)depot contains of (|quasi-)scalar types with possreps, and complete (|quasi-)nonscalar types, and union types, and restriction 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.DepTypeSet A C is a C that specifies a set of 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 type's parent (|sub)depot. =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 defines the entire 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 6 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 - C These are all the definitions that this package contains of (|quasi-)scalar types with possreps, and complete (|quasi-)nonscalar types, and union types, and restriction 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.PkgTypeSet A C is a C that specifies a set of types that a package might contain, where each 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 type. =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 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 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 4 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. =item C - C This indicates the subset of the function's parameters that are optional, that is, do not need to be supplied explicit arguments when the function is invoked; any function parameters not named here must be supplied explicit arguments. Any parameter marked as optional which is not given an explicit argument will implicitly default to the default value of its declared type. Each element of C must match a parameter name in C. =back The default value of C has zero parameters and a result type of C; by default, its parameters are all non-optional. =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 4 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. =item C - C This indicates the subset of the updater's subject-to-update or read-only parameters that are optional, that is, do not need to be supplied explicit arguments when the function is invoked; any updater parameters not named here must be supplied explicit arguments. Any parameter marked as optional which is not given an explicit argument will implicitly default to the default value of its declared type; any subject-to-update parameter marked as optional which is not given an explicit argument will implicitly bind to a new anonymous variable (with the aforementioned default value) which is discarded after the updater finishes executing. Each element of C must match a parameter name in either C or C. =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; by default, its parameters are all non-optional. =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 4 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. =item C - C This is as per the same-named attribute of C. =back There is a distributed (unique) key over the C attributes of C and C. The default value of C has zero parameters; by default, its parameters are all non-optional. =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 4 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 type definitions that this function contains. =back There is a distributed (unique) key over both the C attributes of C and the C attributes of all the 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 5 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 type definitions that this updater contains. =back There is a distributed (unique) key over both the C attributes of C and the C attributes of all the 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 6 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 type definitions that this procedure contains. =back There is a distributed (unique) key over both the C attributes of C and the C attributes of all the 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 11 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. =item C - C These are expression nodes that represent if-else control flow expressions. =item C - C These are expression nodes that represent given-when-default control flow expressions. =item C<(func|proc|type|ord_det_func)_ref_lit_exprs> - C These are expression nodes that define function|imperative-routine|type|order-determination-function reference literals. =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.IfElseExprNodeSet A C is a C that specifies a set of value expression nodes where each node represents an N-way if-else control flow expression. The reason that the C expression node type exists, rather than this functionality being provided by an ordinary function invocation, is because the semantics of an if-else expression require its sub-expressions to be evaluated in a specific sequence and that later elements in the sequence are evaluated only conditionally based on the results of earlier elements in the sequence, whereas with ordinary functions the operands are all independent of each other, can be done in any order, and can all be evaluated prior to the function. The main scenario that requires the special semantics is when an earlier conditional part of the sequence is testing whether it is even logically possible to evaluate a later part of the sequence; for example, the first condition may test if a value is a member of a certain data type, and a later part of the sequence may want to use some operator on the value that is only defined for the certain data type (invoking it on something else would result in a failure/exception); so only known-safe/appropriate expressions then get evaluated. 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 a sequence of 0..N conditional expressions, each of which has an associated result expression. Each conditional expression will evaluate in order while the previous conditional resulted in C; once a conditional results in C, its associated result expression will evaluate and be the result of the larger if-else sequence, and no more conditionals will be evaluated; no result expressions will be evaluated except the one with the true conditional. =item C - C Iff none of the conditionals in C result in C (or as a trivial case, if C is an empty sequence), then the result expression represented by the local expression node (or parameter) named by C will be evaluated, and be the result of the larger if-else. =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head2 sys.std.Core.Type.Cat.GivenWhenDefExprNodeSet A C is a C that specifies a set of value expression nodes where each node represents an N-way given-when-default switch control flow expression that dispatches based on matching a single value with several options. A C is essentially a more specialized version of a C where every condition expression is a simple value equality test and one of the operands is the same for all the conditions in the set; also, with a given-when-default it doesn't matter what order the conditionals are tested to find a true resulting one. 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 the single operand value that is common to all the conditions; it is the control value for the expression. =item C - C This is a set of distinct condition operand values, each of which has an associated result expression. If a condition operand matches the value of C, its associated result expression will evaluate and be the result of the larger if-else sequence; no result expressions will be evaluated except the one with the matching conditional operand. =item C - C Iff none of the condition operand values in C matches the value of C (or as a trivial case, if C has no tuples), then the result expression represented by the local expression node (or parameter) named by C will be evaluated, and be the result of the larger given-when-default. =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head2 sys.std.Core.Type.Cat.(Func|Proc|Type|OrdDetFunc)RefLitExprNodeSet A C is a C that specifies a set of expression nodes where each node represents a value of the special C type. 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 name, from the point of view of the routine embedding this expression node, of the function|imperative-routine|type|order-determination-function that the new special reference value is supposed to facilitate portable invoking of. =back A C has a unary (unique) key on the C attribute, plus another such 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 read-only 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 statement tree that comprises the entire (|inner )procedure body. =back There is a distributed (unique) key over the C attribute of C and 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 statement tree of named statement nodes, each of which is a tuple of one of its C attributes. If it has zero member nodes, then the (|inner )procedure is a no-op. Otherwise: All member nodes must define a simple statement 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 )procedure invocations are allowed); the name of the root node must be the empty string. Note that the composed-into (|inner )procedure's parameters are also implicitly tree nodes, and are referenced by name into the statement tree the same way as any other named statement node is. The statement tree should reference all of the parameters and lexical variables that the (|inner )procedure has, but this isn't a strict requirement. The default value of C directly corresponds to the default value of C and is a no-op, having an empty statement tree. =head2 sys.std.Core.Type.Cat.StmtNodeSet A C is a C that specifies a set of named statement nodes. It is typically composed into a (|inner )procedure. Each tuple of a C attribute is a named statement node, from which non-implicitly-atomic procedural Muldis D code is composed. Note that, regarding Muldis D's feature of a statement node having an explicit C that can be referenced by "leave" and "iterate" control flow statements to leave or re-iterate the corresponding block, both SQL and Perl have native counterpart features in the form of block labels. A C has these 7 attributes: =over =item C - C These are statement nodes that represent abnormal block exit statements. =item C - C These are statement nodes that each represent a compound statement having a sequence of 0..N procedure statements. =item C - C These are statement nodes that invoke (|inner )procedures. =item C - C These are statement nodes that represent if-else control flow statements. =item C - C These are statement nodes that represent given-when-default control flow statements. =item C - C These are statement nodes that represent abnormal block restart statements. =item C - C These are statement nodes that represent generic looping block statements. =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.LeaveStmtNodeSet A C is a C that specifies a set of statement leaf nodes where each node represents an instruction to abnormally exit the block defined by a parent statement node (a normal exit is to simply execute to the end of the block). If the parent node in question is the root statement node for the containing (|inner )procedure, then the latter will be exited; this is how a "return" statement is represented, but "return" is still easy to recognize because the root node always has the empty string as its name. If the parent node in question is an iterating or looping statement, then any remaining iterations it might have had are skipped, especially useful if it was an infinite loop. A C has these 3 attributes: =over =item C - C This is the declared name of the statement node. =item C - C This is an optional programmer comment about the statement leaf node. =item C - C This is the name of the parent statement node we wish to abnormally exit; note that this reference does not count as making the other node a child of the current one, so this reference does not contribute to a cycle. =back A C has a unary (unique) key on the C attribute, plus another such key on the C attribute. Its default value is empty. =head2 sys.std.Core.Type.Cat.CompoundStmtNodeSet A C is a C that specifies a set of statement nodes where each node is a compound statement composed of a sequence of 0..N other statements. A C has these 3 attributes: =over =item C - C This is the declared name of the statement node. =item C - C This is an optional programmer comment about either the statement node or the statement node (sub-)tree it is the root of. =item C - C This is a sequence of names of 0..N other local statement nodes; the current compound statement consists of having those other statements execute in this given sequence. =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head2 sys.std.Core.Type.Cat.ProcInvoStmtNodeSet A C is a C that specifies a set of statement nodes where each node is an invocation of some other procedural routine (eg, procedure, update operator, system service, 'inner' variant) with specific arguments. The invoked routine can be either user-defined or system-defined. A C has these 5 attributes: =over =item C - C This is the declared name of the statement node. =item C - C This is an optional programmer comment about either the statement node or the statement node (sub-)tree it is the root of. =item C - C This is the name of the procedural routine being invoked. =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 A C has a unary (unique) key on the C attribute. Its default value is empty. There is a distributed (unique) key over the C attributes of C and C. =head2 sys.std.Core.Type.Cat.IfElseStmtNodeSet A C is a C that specifies a set of statement nodes where each node represents an N-way if-else control flow statement. A C is essentially the imperative version of the functional C, except that for design simplicity, all of the conditionals need to be pre-evaluated and their boolean results stored in variables (but this could be a lazy though still necessarily deterministic operation, so work isn't actually done if the results aren't needed); if any conditionals could only be conditionally evaluated, then the necessary logic means this if-else statement must be broken up into multiple nested if-else. A C has these 4 attributes: =over =item C - C This is the declared name of the statement node. =item C - C This is an optional programmer comment about either the statement node or the statement node (sub-)tree it is the root of. =item C - C This is a sequence of 0..N conditional result variable names, each of which has an associated statement. Each conditional result will be tested in order while the previous conditional result is C; once a conditional result is C, its associated statement will be invoked; no statements will be invoked except the one with the true conditional result. =item C - C Iff none of the conditional results in C is C (or as a trivial case, if C is an empty sequence), then the statement represented by the local statement node named by C will be invoked iff C is a C; if under the first circumstance C is a C, then the whole if-else will have been a no-op. =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head2 sys.std.Core.Type.Cat.GivenWhenDefStmtNodeSet A C is a C that specifies a set of statement nodes where each node represents an N-way given-when-default switch control flow statement that dispatches based on matching a single value with several options. A C is essentially the imperative version of the functional C. A C has these 5 attributes: =over =item C - C This is the declared name of the statement node. =item C - C This is an optional programmer comment about either the statement node or the statement node (sub-)tree it is the root of. =item C - C This is name of the local parameter or variable that supplies the single operand value that is common to all the conditions; it is the control value for the statement. =item C - C This is a set of distinct condition operand values, each of which has an associated statement. If a condition operand matches the value of C, its associated statement will be invoked; no statements will be invoked except the one with the matching conditional operand. =item C - C Iff none of the condition operand values in C matches the value of C (or as a trivial case, if C has no tuples), then the statement represented by the local statement node named by C will be invoked iff C is a C; if under the first circumstance C is a C, then the whole given-when-default will have been a no-op. =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head2 sys.std.Core.Type.Cat.IterateStmtNodeSet A C is a C that specifies a set of statement leaf nodes where each node represents an instruction to abnormally end the current iteration of a looping block defined by a parent statement node, and then start at the beginning of the next iteration of that loop if there are any left ("normal" is to simply execute to the end of the block before starting the next iteration). The same semantics apply for the beginning of the next loop as if the current block iteration had executed to the end before repeating. A C has these 3 attributes: =over =item C - C This is the declared name of the statement node. =item C - C This is an optional programmer comment about the statement leaf node. =item C - C This is the name of the parent statement node we wish to abnormally exit and restart; note that this reference does not count as making the other node a child of the current one, so this reference does not contribute to a cycle. =back A C has a unary (unique) key on the C attribute, plus another such key on the C attribute. Its default value is empty. =head2 sys.std.Core.Type.Cat.LoopStmtNodeSet A C is a C that specifies a set of statement nodes where each node represents a generic looping statement block which iterates until a child "leave" statement executes. A C has these 3 attributes: =over =item C - C This is the declared name of the statement node. =item C - C This is an optional programmer comment about either the statement node or the statement node (sub-)tree it is the root of. =item C - C This is the name of the local statement node that will get executed for each iteration of the loop; typically it has a sub-tree of statement nodes. =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head1 TYPES FOR DEFINING DATA TYPES =head2 sys.std.Core.Type.Cat.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 3 attributes: =over =item C - C This is an optional programmer comment about the type as a whole. =item C - C These are all the inner type definitions that this type contains. There must be at least 1 inner type here, and exactly 1 of the inner types must have the empty string as its name; that inner type defines the actual main type that the C is a wrapper for, and the other inner types, if any, support it. =item C - C These are all the inner function definitions that this type contains, which support the main type or inner types. =back There is a distributed (unique) key over both the C attributes of all the attributes of C and the C attributes of C. The default value of C is as per C. =head2 sys.std.Core.Type.Cat.InnerTypeSet A C is a C that specifies a set of named inner types. It is typically composed into a function|updater|procedure|outer-type. A C has these 4 attributes: =over =item C - C These are all the inner scalar|nonscalar|union|restriction type definitions that this type contains. =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.Inner(Sca|Nonsca|Uni|Restr)TypeSet A C is a C that specifies a set of inner scalar|nonscalar|union|restriction types that a function|updater|procedure or scalar|nonscalar|union|restriction type might contain. A C has these 3 attributes: =over =item C - C This is the declared name of the inner scalar|nonscalar|union|restriction type. =item C - C This is an optional programmer comment about the inner scalar|nonscalar|union|restriction type as a whole. =item C - C This defines the entire inner scalar|nonscalar|union|restriction 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 7 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. Note that, to keep things simple and deterministic under the possibility of diamond subtype/supertype relationships (such that the generic system-defined scalar possrep attribute accessors can work), Muldis D requires all of the possreps of all scalar types having a common scalar root type to have mutually distinct names, regardless of whether any subtypes have values in common; this can be enforced at type-definition-in-catalog time since all types that can interact are in the same depot. =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 C 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. =item C - C A (|quasi-)scalar root type definition may optionally have a type-default total ordering function associated with it (a type being defined as a subtype may not); iff the type being defined qualifies and desires such an associated function, then C is a C whose sole element defines the entire (main) body of a C function. The implicit function heading that this goes with has 3 parameters; the first two parameters, named C and C, each have declared types that are the same as the (|quasi-)scalar root type whose declaration the function is part of, and this function is said root type's type-default ordering function; the third parameter, named C, is C-typed; the function's implicit result type is C. Iff the type being defined is a subtype of some other type or does not desire the function, then C is a C. =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. Note that, strictly speaking, any constraint defined as part of a possrep (where there are multiple possreps) may actually be less restrictive than the total constraint of (|sub-)type as a whole, because the total constraint is defined by I-ing the constraints of all the possreps of the (|sub-)type; therefore, mainly any given possrep's constraints need to be just restricting enough so that the inter-possrep mapping functions can handle the arguments that it accepts, so it is possible to apply the other possreps' constraints. =back A C has a unary (unique) key on the C attribute. Its default value is empty. The default value of a tuple of C has a C that is the empty string, its C is empty, and its C unconditionally results in C. =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 C 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 C 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 14 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 This defines the proper subset of this type's attributes that are virtual, and how they are defined in terms of the rest of this type's attributes. Note that the special functional dependencies between attributes defined herein mean that some kinds of tuple constraints would be redundant. =item C - C This defines the entire (main) bodies of 0..N C functions that (when I-ed together) determine what combinations of tuple attribute values denote values of the (|sub-)type, besides the restrictions imposed by the declared types of the attributes individually; they are generalized type constraints that together validate a tuple as a whole. The implicit function heading that each of these 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 functions unconditionally result in C, then all possible combinations of attribute-allowable values are collectively allowed. Each 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 each function's parameter is relation-typed rather than tuple-typed; each is a generalized type constraint that validates a relation as a whole. =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 an abstraction 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 attribute values comprise a key if the cardinalities are equal. =item C - C These are the 0..N explicit simple distributed (unique) keys that are applicable to tuple/database values of the type being defined, that range over specified relation-typed attributes of it. Note that C is logically an abstraction syntax (the canonical simplest form) for a particular kind of C of the type being defined, one that compares the cardinality of the union of the projection of distributed key attributes of all key-participating relation-valued attributes, with the sum of cardinalities of the source relation-valued attributes; the attribute values comprise a distributed key if the cardinalities are equal. =item C - C These are the 0..N explicit simple foreign (non-distributed) keys that are applicable to tuple/database values of the type being defined, that range over and relate tuples of specified relation-typed attributes of it; they are a kind of referential constraint. Each tuple of a child attribute must have a corresponding tuple in a specific single parent attribute, where they correspond on the attributes of the parent attribute that comprise a (unique) key of the latter. Note that C is logically an abstraction syntax (the canonical simplest form) for a particular kind of C of the type being defined, one that tests if the relational difference, where a projection of the parent relation is subtracted from a corresponding projection of the child relation (with attribute renaming if necessary), is an empty relation; if the difference is an empty relation, then the foreign key is satisfied; otherwise, any difference tuples are from child tuples that violate the foreign key. =item C - C These are the 0..N explicit simple foreign distributed keys that are applicable to tuple/database values of the type being defined, that range over and relate tuples of specified relation-typed attributes of it; they are a kind of referential constraint. Each tuple of a child attribute must have a corresponding tuple in one member of a specific set of parent-alternative attributes (that have a distributed key ranging over them), where they correspond on the attributes of the parent-alternative attribute that comprise a distributed key on the latter. Note that C is logically an abstraction syntax (the canonical simplest form) for a particular kind of C of the type being defined; it is as per C except that the parent relation is the result of unioning appropriately renamed projections of the member relations of the distributed key. =item C - C This defines the entire (main) body of a C 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 C 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 There is a distributed (unique) key over the C attributes of C<(tuple|relation)_constraint> and C<(|foreign_)(|distrib_)keys>. 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.VirtualAttrMapSet A C is a C that defines special functional dependencies between attributes of a (|quasi-)nonscalar data type, such that, on a per-tuple basis, some attributes can be generated purely from other attributes, and hence the former attributes may be virtual. Each tuple of a C specifies 2 disjoint subsets of the (|quasi-)nonscalar's attributes, which are I and I attributes respectively, where the values of the second set are generated from the first using a C function. Whether I attributes are computed when needed or pre-computed and stored (a trade-off of storage space for speed) is implementation dependent, though users may give hints to govern that performance decision. The main reason for virtual attributes to exist is to provide a fundamental feature of a relational database where multiple perceptions of the same data can exist at once; each user can perceive the same data being organized according to their own preferences, and even if the actual means of storing the data changes over time, the users continue to be able to perceive it in the same ways as before the change. The most important use case of virtual attributes is when the data type having them is a database type, all of whose attributes are relations (or databases); and so these attributes define database relvars, with non-virtual and virtual attributes being base and virtual relvars, respectively (which correspond to the SQL concepts of base tables and views, respectively). The idea in general is that users can work with any relvar without knowing whether it is base or virtual, and so if implementations change later such that real relvars become virtual or vice-versa, users could continue as if nothing changed. A less common use case of virtual attributes is in (typically non-database) nonscalar types when users want to treat non-identical values as being distinct in some situations and non-distinct in others. For example they want to do case-insensitive matching of character data, or alternately they want a case-insensitive (unique) key constraint on such, but either way they want the case of the data preserved. In this situation, a base attribute can exist with the original case-preserved data, and a dependent virtual attribute can exist with the first's values folded to uppercase (eliminating any case differences); so then the key constraint can be placed on the virtual attribute to get the desired semantics, and the matching can be done against the same. All permissable operations on virtual (|pseudo-)variables are such that the semantics of updating them is the same as for updating base (|pseudo-)variables, with respect to I: Following assignment of a value C to a variable C, the comparison C evaluates to TRUE. Just as an update to determinant variables will have the cascade effect of updating their dependent variables such that the functional dependency between them continues to hold, the reverse also must happen. Any update to dependent variables must have the side effect of updating their determinant variables. Specifically, the implementing code of an update to dependents must be rewritten behind the scenes to become instead an update to their determinants, as if the latter was what the users had actually written, such that following the then-first update of the determinants, the cascading update to the dependents by the functional dependency must result in the same dependents' values that they would have had if the dependents were just base variables being updated by the original code. If such a code rewrite can not be done, such as due to information lost in the functional dependency, then the operation attempting to update the dependent attributes must fail. Sometimes the code rewrite can be done automatically by the DBMS, and sometimes it can succeed if the map definer gives explicit details on how to accomplish it. Because Muldis D requires a strong degree of determinism in the whole system, sometimes users have to provide explicit details on how to accomplish a reverse mapping, even if it is possible to automatically generate such, because there may be multiple ways to do a reverse map that satisfy I, so the explicitness would be to pick exactly one of those, so that how determinants are updated is predictable in an implementation-portable manner. For example, if a virtual relvar C is defined as the simple relational union of 2 other relvars C and C, then a tuple insertion into C could be rewritten at least 3 ways, which are an insertion into just C, or into just C, or into both C and C; so for predictability's sake, the map should specify which option to do (which can vary on a case-by-case basis). I type does not give a way to manually specify a reverse function, so for now all the virtuals are either read-only or updatable due to an automatically generated reverse function, which might vary by implementation. Fixing this matter is TODO. Note that the reverse functions might have to be defined as per-tuple operations, separately for insert/substitute/delete.> A C has these 5 attributes: =over =item C - C This is an optional programmer comment about this virtual attribute map. =item C - C These are the names of the determinant attributes. Each name is given in 2 forms, called C and C; C is the actual name of the attribute as existing in the host type, and it may actually be a component attribute of a host type attribute to any recursive depth (a single C element means it is the actual host type element); C is an alias by which the attribute will be known in the C function; this mapping exists so to make the determinant attributes look like direct sibling attributes whereas in reality they can be further-away relatives, just common components somewhere under the host type. =item C - C These are the names of the dependent attributes; the structure of C is as per C; none of these may be the same as the names of the determinant attributes, since a virtual attribute can't be defined in terms of itself. =item C - C This defines the entire (main) body of a C function that derives a tuple of dependent attribute values from a tuple of determinant attribute values. 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 the range of this function is typically smaller than its domain, though it might not be. =item C - C This is C if all of the dependent attributes should be treated as updateable, because they have enough information to map any kinds of updates (all of tuple insert/substitute/delete) back to their determinant attributes, and the system should try to support updates against them. This is C if all of the dependent attributes should not be considered updateable, either because it is known they don't have enough information, or because we expect users will never try to update them, so don't go to the trouble of supporting updates. =back A C has a binary (unique) key on the C plus C attributes; it also has a distributed (unique) key over the C attribute of all tuples. Its default value is empty. =head2 sys.std.Core.Type.Cat.ConstraintSet A C is a C that specifies a set of named generic constraints for data types or variables; each tuple is one named constraint. Each constraint in the set can be either a C or C or C, but when a set has multiple constraints, all of them must be the same kind, and they must all correspond to the same implicit function heading. One or more (possibly empty) C is composed into the definition each nonscalar type and union type and restriction type and dbvar. A C has these 3 attributes: =over =item C - C This is the declared name of the constraint function. =item C - C This is an optional programmer comment about the constraint as a whole. =item C - C This defines the entire (main) body of the constraint function. =back A C has a unary (unique) key on the C attribute. Its default value is empty. The default value of a tuple of C has a C that is the empty string, and its C unconditionally results in C. =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, and another on its C attribute. Its default value is empty. =head2 sys.std.Core.Type.Cat.DistribKeySet A C is a C that specifies a set of candidate distributed (unique) keys over relation-valued attributes of a tuple/database; each tuple specifies one distributed (unique) key. A C has these 5 attributes: =over =item C - C This is the declared name of the distributed (unique) key. =item C - C This is an optional programmer comment about the distributed (unique) key as a whole. =item C - C This declares the 0..N attributes comprising the distributed (unique) key. If this set is empty, then we have a nullary key which restricts all of the relations participating in the distributed key to have a maximum of 1 tuple between them. Note that the distributed key attribute names don't have to match the names of any participating relation attributes. =item C - C This names the 0..N relation-valued attributes of the host tuple/database type that are participating in the distributed key, and says which of each of their attributes maps to the attributes of the distributed key itself. If this set is empty, then the distributed key has no effect. The unary projection of every tuple of the C attribute of C must be identical to C. =item C - C This has the same meaning as C of C but for being distributed as if the relations distributed over were one relation. =back A C has a unary (unique) key on the C attribute, and another on its C attribute. Its default value is empty. =head2 sys.std.Core.Type.Cat.DKMemRelAttrMap A C is a C that names the 0..N relation-valued attributes of a host tuple/database type that are participating in a distributed key, and says which of each of their attributes maps to the attributes of the distributed key itself. A C has these 3 attributes: =over =item C - C This is the name of the relation-valued attribute that is participating in the distributed key. But the attribute named by C is only a direct attribute of the host type if C has 1 chain element; if it has more, then the host type attribute is a tuple/database and any further elements serve to make C actually address a component of said. =item C - C This is an optional programmer comment about the participation. =item C - C This maps 0..N attributes of the relation with the same number of attributes of the distributed key. Every tuple of C must have an identical value for the unary projection on its C attribute; in other words, they must all map with the same distributed key attributes. =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head2 sys.std.Core.Type.Cat.DKRelAttrKeyAttrMap A C is a C. It maps 0..N attributes of a relation-valued attribute of a host tuple/database type participating in a distributed key, to the same number of attributes of the distributed key itself. 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. =head2 sys.std.Core.Type.Cat.ForeignKeySet A C is a C that specifies a set of foreign (non-distributed) keys over relation-valued attributes of a tuple/database; each tuple specifies one foreign key, which is a kind of referential constraint, that relates tuples of such attributes. Each tuple of a child attribute must have a corresponding tuple in a specific single parent attribute, where they correspond on the attributes of the parent attribute that comprise a (unique) key of the latter. Note that it is valid to define a foreign key involving zero attributes, but its effect would be a no-op / a constraint that rejects nothing. A C has these 6 attributes: =over =item C - C This is the declared name of the foreign key. =item C - C This is an optional programmer comment about the foreign key as a whole. =item C - C This is the name of the relation-valued attribute that is the parent in the foreign (non-distributed) key relationship. But the attribute named by C is only a direct attribute of the host type if C has 1 chain element; if it has more, then the host type attribute is a tuple/database and any further elements serve to make C actually address a component of said. =item C - C This is the name of the explicitly declared candidate key or unique key constraint of C which defines the attributes of C that are being matched on in the foreign key. =item C - C This is the name of the relation-valued attribute that is the child in the foreign (non-distributed) key relationship; its structure is as per C. Note that C and C are allowed to be one and the same. =item C - C This maps 0..N attributes of the child relation with the same number of attributes of the parent relation; the mapped attribute names may or may not be the same. =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head2 sys.std.Core.Type.Cat.ForeignDistribKeySet A C is a C that specifies a set of foreign distributed keys over relation-valued attributes of a tuple/database; each tuple specifies one foreign key, which is a kind of referential constraint, that relates tuples of such attributes. Each tuple of a child attribute must have a corresponding tuple in one member of a specific set of parent-alternative attributes (that have a distributed key ranging over them), where they correspond on the attributes of the parent-alternative attribute that comprise a distributed key on the latter. Note that it is valid to define a foreign key involving zero attributes, but its effect would be a no-op / a constraint that rejects nothing. A C has these 5 attributes: =over =item C - C This is the declared name of the foreign key. =item C - C This is an optional programmer comment about the foreign key as a whole. =item C - C This is the name of the explicitly declared distributed (unique) key that is the parent in the foreign distributed key relationship; it defines by proxy the attributes that are being matched on in the foreign key. But the distributed key named by C may not be directly declared by the host type of this foreign key; it might be declared by the type of an attribute of the host type, if said attribute is a tuple/database; so the only or last C chain element is a key name, and any preceeding names are attribute names. =item C - C This is the name of the relation-valued attribute that is the child in the foreign distributed key relationship. But the attribute named by C is only a direct attribute of the host type if C has 1 chain element; if it has more, then the host type attribute is a tuple/database and any further elements serve to make C actually address a component of said. =item C - C This maps 0..N attributes of the child relation with the same number of attributes of the parent distributed key; the mapped attribute names may or may not be the same. =back A C has a unary (unique) key on the C attribute. Its default value is empty. =head2 sys.std.Core.Type.Cat.FKChildAttrParentAttrMap A C is a C. It maps 0..N attributes of a child relation-valued attribute of a host tuple/database type participating in a foreign non-distributed or distributed key, to the same number of attributes of a parent such attribute or a distributed key of the host. 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. =head2 sys.std.Core.Type.Cat.InnerUnionType 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 not-C 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 (and then optionally applying 0..N type constraint functions to the values remaining). The likely most common such type definition scenario is defining a simple explicit union type of 2+ scalar source types. Less likely for usage, you can also define simple explicit intersection or difference or exclusion types. A union 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 union type as a whole. =item C - C These are the names of the 1..N other not-C 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; iff this is C then the set of source data types will be unioned to determine the complete set of source values. =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 unioning (the default) or intersecting the values of these types. =item C - 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; 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. =item C - C This defines the entire (main) bodies of 0..N C functions that (when I-ed together) determine what filter-type-passing source-type values are part of the union type. The implicit function heading that each of these 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 functions unconditionally result in C, then all filter-type-passing values are allowed. =item C - C This defines the entire (main) body of a C function that results in the default value of the union type; it has zero parameters and its result type is the same as the union type whose declaration it is part of. =back The default value of C defines an alias for C, with the same default value; it has just the source type C and zero filter types, both type lists are unioned, and C is empty (unconditionally C). Note that there is no valid combination of C attribute values that would result in an alias for the C type, due to C being mandatory. =head2 sys.std.Core.Type.Cat.InnerRestrType A C is a C. It provides a relatively terse method to define a simple restriction-defined subtype of a single other type (which can be any not-C type at all), which is a common kind of type to have. The new type is either a proper or non-proper subset of the other type, whose values are determined from applying 0..N type constraint functions to the parent type; either way, the new type does declare its own default value. An alternate common scenario is to define a non-proper subtype of its parent type that serves just to supply a different default value for the context in which the new type is used. A restriction 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 type. 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 4 attributes: =over =item C - C This is an optional programmer comment about the inner restriction type as a whole. =item C - C This is the name of the not-C other type that all the values of the new data type are drawn from; the new type is being declared as a subtype of that named by C. =item C - C This defines the entire (main) bodies of 0..N C functions that (when I-ed together) determine what base type values are part of the restriction type. The implicit function heading that each of these goes with has a single C parameter whose declared type is that named by C, and whose argument is the value to test; the function's implicit result type is C. If the functions unconditionally result in C, then the new type is a non-proper subtype of the base type. =item C - C This defines the entire (main) body of a C function that results in the default value of the restriction type; it has zero parameters and its result type is the same as the restriction type whose declaration it is part of. =back The default value of C defines an alias for C, with the same default value; it has the base type C and C is empty (unconditionally C). Note that there is no valid combination of C attribute values that would result in an alias for the C type, due to C being mandatory. =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 NONSCALAR 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.NameDNCMap A C is a C. It defines an association of a short name with a declaration name chain, to be used for aliasing the latter with the former in a particular context. A C has 2 attributes, C (a C) and C (a C); each of those is a unary key. 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. =head2 sys.std.Core.Type.Cat.IfThenMap A C is a C. It defines an element of an if-else sequential expression or statement. A C has 2 attributes, C and C, each of which is a C; C has the name of a local expression node (or parameter or variable), and C in the case of an if-else expression has likewise, or in the case of an if-else statement has the name of a statement node. For an if-else expression, the C node is the condition to evaluate; if that condition evaluates to C, then the C node is evaluated and its result is the result of the whole if-else expression; otherwise, C is not evaluated. For an if-else statement, the C node is the conditional result variable name; if that conditional result is C, then the C statement node is invoked; otherwise, C is not invoked. Its default value has the default value of the C type in both attributes. =head2 sys.std.Core.Type.Cat.WhenThenMap A C is a C. It defines a set of dispatch options for a given-when-default expression or statement. A C has 2 attributes, C and C, each of which is a C; C has the name of a local expression node (or parameter or variable), and C in the case of a g-w-d expression has likewise, or in the case of a g-w-d statement has the name of a statement node. The C node is the not-common / distinct operand for each condition. For a g-w-d expression, if a C value is matched, then the C node is evaluated and its result is the result of the whole g-w-d expression; otherwise, C is not evaluated. For a g-w-d statement, if a C value is matched, then the C statement node is invoked; otherwise, C is not invoked. Its default value has zero tuples. =head1 TYPES FOR SPECIAL ENTITY REFERENCES Muldis D needs to support the concept of a closure or higher-order function, mainly for functions but also to a smaller extent for imperative routines. For example, the generic relational restriction operator is designed to conceptually take a function as an argument and then invoke that function on each tuple of a relation it is filtering, and the function has the criteria for whether the tuple passes the filter. Conceptually, all that is needed is to pass the fully-qualified name of the routine as such an argument, which in the system catalog is represented as a C. But using an actual C frequently doesn't work to support closures because the typical closure is defined as an I and those are expressly private to the context of the outer entity that the inner is embedded in. There is no valid C value for referencing it from outside that context (likewise for routines declared private to a package), and outside that context is typically where the routines that take closures as arguments would live. For example, if public function C had an inner function C and C invoked the public function C with an argument value of C, then if C tried to invoke the function it was passed, it would actually be trying to invoke an inner function of C named C, which won't work. Conceptually, a solution to this problem is to actually pass a routine name in a more fully-qualified form, conceptually like C, which then C could correctly invoke. However, if that was made to work literally with a C, then this could cause problems where anything could invoke C directly without being given permission from C. As an at-least-initial solution to this problem, here are a few black box data types (specifically, quasi-scalar types with no possreps) which will provide fully-qualified identifiers for routines, useful as alternatives to C values, so any routine may be correctly invoked from any other routine, without losing privacy. Values of these types work their magic by embedding knowledge about the lexical-et-al context in which they were selected, so that when routines are to be invoked by way of those values, the invocation of the capture effectively takes place within the same context where the special type values were selected, as users would conceptually expect. Selecting one of these special values involves a C argument, and the identity of the selected special value is based on the combination of the argument and the context of selection, more or less. At the same time, every one of these values may incorporate a meaningless random element to make every selection produce a distinct value, even if more than one would have the same semantics. However, normal value assignment et al will preserve the same value of course, so identity comparison of a C with a C that was previously assigned to it would result in TRUE. Currently, selecting these special values can not be done with an ordinary routine, but only with a special catalog type for an expression or statement node, due to the unusualness of this. It is also not possible to map one of these special values to another type. There are no defined sorting orders for values of these types. There are default values for these types (of course), and those defaults are to system-defined routines, for which incidentally the C solution would always have worked. These types are all infinite. There are also similar special types here for referencing data types, but not for as many of the reasons. Maybe another advantage of all of the above is that this can help compile-time type checking. =head2 sys.std.Core.Type.Cat.FuncRef A C (quasi-scalar) is functionally like a smart C that holds a function name but it remembers the context of its creation. It is used to implement a higher-order function or a functional closure. Its default value is a reference to the C function. =head2 sys.std.Core.Type.Cat.ProcRef A C (quasi-scalar) is functionally like a smart C that holds an imperative routine name but it remembers the context of its creation. It is used to implement an imperative closure. Its default value is a reference to the C updater. =head2 sys.std.Core.Type.Cat.TypeRef A C (quasi-scalar) is functionally like a smart C that holds a data type name but it remembers the context of its creation. It is used in places where the name of a data type to 'use' would be taken as a routine argument. Its default value is a reference to the C data type. =head2 sys.std.Core.Type.Cat.OrdDetFuncRef A C (quasi-scalar) is to a C what a C is to a C; it implements a functional closure but its default value is a reference to to the C function. =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