Darren Duncan > Muldis-D-0.27.0 > Muldis::D::Core::Types_Catalog

Download:
Muldis-D-0.27.0.tar.gz

Annotate this POD

CPAN RT

Open  0
Report a bug
Source   Latest Release: Muldis-D-0.100.0

NAME ^

Muldis::D::Core::Types_Catalog - Muldis D catalog-defining data types

VERSION ^

This document is Muldis::D::Core::Types_Catalog version 0.24.0.

PREFACE ^

This document is part of the Muldis D language specification, whose root document is Muldis::D; you should read that root document before you read this one, which provides subservient details. Moreover, you should read the Muldis::D::Core document before this current document, as that forms its own tree beneath a root document branch.

DESCRIPTION ^

This document contains one or more sections that were moved here from Muldis::D::Core so that that other document would not be too large.

These core data types are more special-purpose in nature and are intended for use in defining or working with the system catalog. Those types that are nonscalar are completely defined types.

Note that whenever an attribute of one of the tuple types isn't significant, given the context (determined by other attributes of the same type), and should be ignored, its value is the default for its type.

Note that many of the tuple types might conceptually have name attributes, but those would actually be provided by any larger types in which they are embedded, rather than by these types themselves.

To keep things simpler for now, most constraint definitions for these types are missing, or just defined informally.

TYPE SUMMARY ^

These system-defined subtypes are specific to defining the system catalog, more or less:

    sys.Core.Type.Universal

        sys.Core.Type.Empty

        sys.Core.Type.Scalar

            # The following are all regular ordered scalar types.

            sys.Core.Type.Cat.Name
            sys.Core.Type.Cat.NameChain
            sys.Core.Type.Cat.DeclNameChain
            sys.Core.Type.Cat.Comment

            # The following are all regular non-ordered scalar types.

            sys.Core.Type.Cat.E_TK
            sys.Core.Type.Cat.E_TDM

        sys.Core.Type.Tuple

            # The following are all regular tuple types.

            sys.Core.Type.Cat.System
            sys.Core.Type.Cat.Federation
            sys.Core.Type.Cat.Depot
            sys.Core.Type.Cat.Package
            sys.Core.Type.Cat.FuncHead
            sys.Core.Type.Cat.UpdHead
            sys.Core.Type.Cat.ProcHead
            sys.Core.Type.Cat.FuncBody
            sys.Core.Type.Cat.UpdBody
            sys.Core.Type.Cat.ProcBody
            sys.Core.Type.Cat.InnerFuncBody
            sys.Core.Type.Cat.ExprNodeSet
            sys.Core.Type.Cat.InnerUpdBody
            sys.Core.Type.Cat.InnerProcBody
            sys.Core.Type.Cat.ProcStmt
            sys.Core.Type.Cat.Type
            sys.Core.Type.Cat.Exception

        sys.Core.Type.Relation

            # The following are all regular relation types.

            sys.Core.Type.Cat.SysNspSet
            sys.Core.Type.Cat.Sys(Func|Upd|Proc)Set
            sys.Core.Type.Cat.DepotMountSet
            sys.Core.Type.Cat.SubdepotSet
            sys.Core.Type.Cat.PackageSet
            sys.Core.Type.Cat.Dep(Func|Upd|Proc)Set
            sys.Core.Type.Cat.Pkg(Func|Upd|Proc)Set
            sys.Core.Type.Cat.Inner(Func|Upd|Proc)Set
            sys.Core.Type.Cat.ScaLitExprNodeSet
            sys.Core.Type.Cat.ScaPRLitExprNodeSet
            sys.Core.Type.Cat.TupLitExprNodeSet
            sys.Core.Type.Cat.RelLitExprNodeSet
            sys.Core.Type.Cat.FuncInvoExprNodeSet
            sys.Core.Type.Cat.MultiUpdStmt
            sys.Core.Type.Cat.NameTypeMap
            sys.Core.Type.Cat.NameExprMap
            sys.Core.Type.Cat.AttrRenameMap

            sys.Core.Type.Set

                # The following are all regular set types.

                sys.Core.Type.Cat.SetOfName
                sys.Core.Type.Cat.SetOfNameExprMap
                sys.Core.Type.Cat.SetOfSetOfName
                sys.Core.Type.Cat.SetOfNameChain

            sys.Core.Type.Seq

                # The following are all regular sequence types.

                sys.Core.Type.Cat.SeqOfProcStmt

These system-defined subtypes are used as the declared types of some parameters of some system-defined N-ary routines, but they are not used in defining the system catalog itself; it is not anticipated that they would be used for user data:

    sys.Core.Type.Universal

        sys.Core.Type.Empty

        sys.Core.Type.Relation
            sys.Core.Type.Set

                # The following are all nonscalar type factories.

                sys.Core.Type.QuasiCat.SetOfTuple
                sys.Core.Type.QuasiCat.SetOfRelation
                    sys.Core.Type.QuasiCat.SetOfBag

                sys.Core.Type.Maybe

                    # The following are all nonscalar type factories.

                    sys.Core.Type.QuasiCat.MaybeOfTuple

            sys.Core.Type.Seq

                # The following are all nonscalar type factories.

                sys.Core.Type.QuasiCat.SeqOfSeq

            sys.Core.Type.Bag

                # The following are all nonscalar type factories.

                sys.Core.Type.QuasiCat.BagOfTuple
                sys.Core.Type.QuasiCat.BagOfRelation

        sys.Core.Type.QuasiRelation
            sys.Core.Type.QuasiSet

                # The following are all quasi-nonscalar type factories.

                sys.Core.Type.QuasiCat.QuasiSetOfTuple
                sys.Core.Type.QuasiCat.QuasiSetOfRelation

TYPES FOR DEFINING ENTITY NAMES AND COMMENTS ^

sys.Core.Type.Cat.Name

A Cat.Name (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 Cat.Name, depending on the context; other times, a Cat.NameChain must be used instead to also qualify the reference with a namespace. Cat.Name is the same as Text 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 Text.

sys.Core.Type.Cat.NameChain

A Cat.NameChain (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 Cat.NameChain is conceptually a sequence of 2..N Cat.Name, the 2..N elements being ordered from parent-most to child-most component name. A Cat.NameChain has 2 system-defined possreps, named seq and flat, both of which are defined over Cat.Name.

The seq possrep directly matches the conception of the type; it consists of 1 attribute whose name is the empty string; the attribute is a Seq whose value attribute has a declared type of Cat.Name and that must have at least 2 elements.

The flat possrep consists of 1 attribute whose name is the empty string; the attribute is a Cat.Name, 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 (.) between the parts, and each part escaped such that backslashes, single-quotes, and periods are escaped as \b, \q and \p respectively.

The default and minimum value of Cat.NameChain is a 2 element sequence where each element is the default value of Cat.Name (the empty string); its maximum value is an infinite sequence where each element is the maximum value of Cat.Name (an infinite-length string) and practically impossible. The cardinality of this type is infinity; to define a most-generalized finite Cat.NameChain subtype, you must specify a maximum number of sequence elements of its values, and each element must be of a finite Cat.Name subtype.

sys.Core.Type.Cat.DeclNameChain

A Cat.DeclNameChain (scalar) is mostly the same as a Cat.NameChain but that it is a sequence of 0..N rather than 2..N, and that its flat 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 flat possrep consisting of just a period. A Cat.DeclNameChain 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 Cat.DeclNameChain is a zero element sequence.

sys.Core.Type.Cat.Comment

A Cat.Comment (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. Cat.Comment is exactly the same as Cat.Name 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 Cat.Name.

TYPES FOR DEFINING SYSTEM-DEFINED ENTITIES ^

sys.Core.Type.Cat.System

A Cat.System is a Tuple. 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 (sys|mnt|fed|dep|sdp|pkg).cat. The system catalog constant named sys.cat is of the Cat.System type.

A Cat.System has these N attributes:

comment - Cat.Comment

This is an optional programmer comment about the collection of system-defined entities as a whole.

namespaces - Cat.SysNspSet

These are all the system-defined namespaces where DBMS entities may live.

functions|updaters|procedures - Cat.Sys(Func|Upd|Proc)Set

These are the interfaces of all the system-defined functions|updaters|procedures.

types - Cat.SysTypeSet

These are the interfaces of all the system-defined types.

catalogs - Cat.SysCatSet

These are the interfaces of all the catalog relcons, relvars.

The default value of Cat.System defines a system with zero builtins.

sys.Core.Type.Cat.SysNspSet

A Cat.SysNspSet is a Relation 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 Cat.SysNspSet only specifies that a system namespace exists, not which public entities it contains; see the Cat.System which contains it for that.

A Cat.SysNspSet has these 3 attributes:

parent - TODO.

TODO.

name - Cat.Name

This is the declared name of the system namespace within the namespace defined by parent; other Muldis D code would reference it with the combination of parent and name.

comment - Cat.Comment

This is an optional programmer comment about this specific system namespace.

A Cat.SysNspSet has a binary (unique) key on the parent plus name attributes. Its default value is empty.

sys.Core.Type.Cat.Sys(Func|Upd|Proc)Set

A Cat.Sys(Func|Upd|Proc)Set is a Relation that specifies a set of system-defined functions|updaters|procedures.

A Cat.Sys(Func|Upd|Proc)Set has these 4 attributes:

parent - TODO.

TODO.

name - Cat.Name

This is the declared name of the function|updater|procedure within the namespace defined by parent; other Muldis D code would reference it with the combination of parent and name.

comment - Cat.Comment

This is an optional programmer comment about the function|updater|procedure as a whole.

head - Cat.(Func|Upd|Proc)Head

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.

A Cat.Sys(Func|Upd|Proc)Set has a binary (unique) key on the parent plus name attributes. Its default value is empty.

TYPES FOR DEFINING FEDERATIONS ^

sys.Core.Type.Cat.Federation

A Cat.Federation is a Tuple. 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 fed.cat is of the Cat.Federation type.

A Cat.Federation has these 2 attributes:

comment - Cat.Comment

This is an optional programmer comment about the federation as a whole.

mounts - Cat.DepotMountSet

These are the depot mounts that comprise the federation.

The default value of Cat.Federation has zero depot mounts.

sys.Core.Type.Cat.DepotMountSet

A Cat.DepotMountSet is a Relation 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 Cat.DepotMountSet has these 3 attributes:

name - Cat.Name

This is the declared name of the depot mount; other Muldis D code would reference it with this name.

comment - Cat.Comment

This is an optional programmer comment about this specific mount of the depot.

depot - Cat.Depot

This defines the entire system catalog of the depot that this mount has made visible to the DBMS.

A Cat.DepotMountSet has a unary (unique) key on the name attribute. Its default value is empty.

TYPES FOR DEFINING DEPOTS AND SUBDEPOTS ^

sys.Core.Type.Cat.Depot

A Cat.Depot is a Tuple. 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 dep.cat and sdp.cat are both of the Cat.Depot type.

A Cat.Depot has these N attributes:

comment - Cat.Comment

This is an optional programmer comment about the (|sub)depot as a whole.

subdepots - Cat.SubdepotSet

These are all the subdepots that this (|sub)depot contains.

packages - Cat.PackageSet

These are all the packages that this (|sub)depot contains.

functions|updaters|procedures - Cat.Dep(Func|Upd|Proc)Set

These are all the function|updater|procedure definitions that this (|sub)depot contains.

types - Cat.DepTypeSet

These are all the type definitions that this (|sub)depot contains. TODO: possibly split into scalar|tuple|relation|etc

vars - TODO: all public variables or pseudo-variables or something
data - TODO: the single main/root database variable

The default value of Cat.Depot defines an empty (|sub)depot.

sys.Core.Type.Cat.SubdepotSet

A Cat.SubdepotSet is a Relation 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 Cat.SubdepotSet only specifies that a subdepot exists, not which depot entities it contains; see the Cat.Depot which contains it for that.

A Cat.SubdepotSet has these 3 attributes:

parent - Cat.DeclNameChain

This is the fully-qualified name, in the dep.(cat|lib|data) namespace, of the subdepot's parent subdepot, which is often just the depot itself.

name - Cat.Name

This is the declared name of the subdepot within the namespace defined by parent; other Muldis D code would reference it with the combination of parent and name.

comment - Cat.Comment

This is an optional programmer comment about this specific subdepot.

A Cat.SubdepotSet has a binary (unique) key on the parent plus name attributes. Its default value is empty.

sys.Core.Type.Cat.PackageSet

A Cat.PackageSet is a Relation that specifies the set of packages that a depot might optionally have for organizing its possibly private entities.

A Cat.PackageSet has these 4 attributes:

parent - Cat.DeclNameChain

This is the fully-qualified name, in the dep.(cat|lib|data) namespace, of the packages's parent (|sub)depot.

name - Cat.Name

This is the declared name of the package within the namespace defined by parent; other Muldis D code would reference it with the combination of parent and name.

comment - Cat.Comment

This is an optional programmer comment about the package definition as associated with this package name.

package - Cat.Depot

This defines the entire system catalog of the package.

A Cat.PackageSet has a binary (unique) key on the parent plus name attributes. Its default value is empty.

sys.Core.Type.Cat.Dep(Func|Upd|Proc)Set

A Cat.Dep(Func|Upd|Proc)Set is a Relation that specifies a set of functions|updaters|procedures that a (|sub)depot might directly contain.

A Cat.Dep(Func|Upd|Proc)Set has these 5 attributes:

parent - Cat.DeclNameChain

This is the fully-qualified name, in the dep.(cat|lib|data) namespace, of the function|updater|procedure's parent (|sub)depot.

name - Cat.Name

This is the declared name of the function|updater|procedure within the namespace defined by parent; other Muldis D code would reference it with the combination of parent and name.

comment - Cat.Comment

This is an optional programmer comment about the function|updater|procedure as a whole.

head - Cat.(Func|Upd|Proc)Head

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.

body - Cat.(Func|Upd|Proc)Body

This defines the entire function|updater|procedure body, that is its implementation, besides what interface defines.

A Cat.Dep(Func|Upd|Proc)Set has a binary (unique) key on the parent plus name attributes. Its default value is empty.

TYPES FOR DEFINING PACKAGES ^

sys.Core.Type.Cat.Package

A Cat.Package is a Tuple. 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 pkg.cat is of the Cat.Package type.

A Cat.Package has these N attributes:

comment - Cat.Comment

This is an optional programmer comment about the package as a whole.

functions|updaters|procedures - Cat.Pkg(Func|Upd|Proc)Set

These are all the function|updater|procedure definitions that this package contains.

types - Cat.PkgTypeSet

These are all the type definitions that this package contains.

vars - TODO: all public variables or pseudo-variables or something
data - TODO: the single main/root database variable

The default value of Cat.Package defines an empty package.

sys.Core.Type.Cat.Pkg(Func|Upd|Proc)Set

A Cat.Pkg(Func|Upd|Proc)Set is a Relation 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 Cat.Pkg(Func|Upd|Proc)Set has these 5 attributes:

name - Cat.Name

This is the declared name of the function|updater|procedure.

comment - Cat.Comment

This is an optional programmer comment about the function|updater|procedure as a whole.

is_public - Bool

This is Bool:true if the function|updater|procedure is part of the package's own public interface and may be invoked from outside the package; it is Bool:false if it is just part of the package's internals.

head - Cat.(Func|Upd|Proc)Head

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.

body - Cat.(Func|Upd|Proc)Body

This defines the entire function|updater|procedure body, that is its implementation, besides what interface defines.

A Cat.Pkg(Func|Upd|Proc)Set has a unary (unique) key on the name attribute. Its default value is empty.

TYPES FOR DEFINING ROUTINE HEADINGS ^

sys.Core.Type.Cat.FuncHead

A Cat.FuncHead is a Tuple. 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 Cat.FuncHead has these 3 attributes:

comment - Cat.Comment

This is an optional programmer comment about the function heading.

result_type - Cat.NameChain

This is the declared result data type of the function as a whole.

params - Cat.NameTypeMap

This is the declared parameter list of the function, which has 0..N named and typed parameters.

The default value of Cat.FuncHead has zero parameters and a result type of Bool.

sys.Core.Type.Cat.UpdHead

A Cat.UpdHead is a Tuple. 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 Cat.UpdHead has these 3 attributes:

comment - Cat.Comment

This is an optional programmer comment about the updater heading.

upd_params - Cat.NameTypeMap

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.

ro_params - Cat.NameTypeMap

This is the declared read-only parameter list of the updater, which has 0..N named and typed such parameters.

There is a distributed (unique) key over the name attributes of upd_params and ro_params.

The default value of Cat.UpdHead has 1 subject-to-update parameter whose name is topic and whose declared type is Bool; it has zero read-only parameters.

sys.Core.Type.Cat.ProcHead

A Cat.ProcHead is a Tuple. 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 Cat.ProcHead has these 3 attributes:

comment - Cat.Comment

This is an optional programmer comment about the procedure heading.

upd_params - Cat.NameTypeMap

This is the declared subject-to-update parameter list of the procedure, which has 0..N named and typed such parameters.

ro_params - Cat.NameTypeMap

This is the declared read-only parameter list of the procedure, which has 0..N named and typed such parameters.

There is a distributed (unique) key over the name attributes of upd_params and ro_params.

The default value of Cat.ProcHead has zero parameters.

TYPES FOR DEFINING ROUTINE BODIES ^

sys.Core.Type.Cat.FuncBody

A Cat.FuncBody is a Tuple. It specifies the entire body or implementation of a function, besides the details that a Cat.FuncHead has, one of which each Cat.FuncBody typically must be paired with.

A Cat.FuncBody has these N attributes:

comment - Cat.Comment

This is an optional programmer comment about the function body.

main_body - Cat.InnerFuncBody

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.

inner_funcs - Cat.InnerFuncSet

These are all the inner function definitions that this function contains.

inner_types - Cat.InnerTypeSet

These are all the inner type definitions that this function contains.

There is a distributed (unique) key over the name attributes of inner_(funcs|types).

The default value of Cat.FuncBody directly corresponds to the default value of Cat.FuncHead and unconditionally results in the value Bool:false.

sys.Core.Type.Cat.UpdBody

A Cat.UpdBody is a Tuple. It specifies the entire body or implementation of an updater, besides the details that a Cat.UpdHead has, one of which each Cat.UpdBody typically must be paired with.

A Cat.UpdBody has these N attributes:

comment - Cat.Comment

This is an optional programmer comment about the updater body.

main_body - Cat.InnerUpdBody

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.

inner_upds - Cat.InnerUpdSet

These are all the inner updater definitions that this updater contains.

inner_funcs - Cat.InnerFuncSet

These are all the inner function definitions that this updater contains.

inner_types - Cat.InnerTypeSet

These are all the inner type definitions that this updater contains.

There is a distributed (unique) key over the name attributes of inner_(upds|funcs|types).

The default value of Cat.UpdBody directly corresponds to the default value of Cat.UpdHead and unconditionally updates its topic argument to the value Bool:false.

sys.Core.Type.Cat.ProcBody

A Cat.ProcBody is a Tuple. It specifies the entire body or implementation of a procedure, besides the details that a Cat.ProcHead has, one of which each Cat.ProcBody typically must be paired with.

A Cat.ProcBody has these N attributes:

comment - Cat.Comment

This is an optional programmer comment about the procedure body.

main_body - Cat.InnerProcBody

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.

inner_procs - Cat.InnerProcSet

These are all the inner procedure definitions that this procedure contains.

inner_upds - Cat.InnerUpdSet

These are all the inner updater definitions that this procedure contains.

inner_funcs - Cat.InnerFuncSet

These are all the inner function definitions that this procedure contains.

inner_types - Cat.InnerTypeSet

These are all the inner type definitions that this procedure contains.

There is a distributed (unique) key over the name attributes of inner_(procs|upds|funcs|types).

The default value of Cat.ProcBody directly corresponds to the default value of Cat.ProcHead and is a no-op, having zero statements.

sys.Core.Type.Cat.Inner(Func|Upd|Proc)Set

A Cat.Inner(Func|Upd|Proc)Set is a Relation that specifies a set of inner functions|updaters|procedures that a function|updater|procedure might contain.

A Cat.Inner(Func|Upd|Proc)Set has these 4 attributes:

name - Cat.Name

This is the declared name of the inner function|updater|procedure.

comment - Cat.Comment

This is an optional programmer comment about the inner function|updater|procedure as a whole.

head - Cat.(Func|Upd|Proc)Head

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.

body - Cat.Inner(Func|Upd|Proc)Body

This defines the entire inner function|updater|procedure body, that is its implementation, besides what interface defines.

A Cat.Inner(Func|Upd|Proc)Set has a unary (unique) key on the name attribute. Its default value is empty.

TYPES FOR DEFINING INNER ROUTINE BODIES ^

sys.Core.Type.Cat.InnerFuncBody

A Cat.InnerFuncBody is a Tuple. It specifies the entire body or implementation of an inner function (or the main body of a function), besides the details that a Cat.FuncHead has, one of which each Cat.InnerFuncBody typically must be paired with.

A Cat.InnerFuncBody has these 2 attributes:

comment - Cat.Comment

This is an optional programmer comment about the (|inner )function body.

expr - Cat.ExprNodeSet

This defines the value expression tree that comprises the entire (|inner )function body.

There is a distributed (unique) key over the name attributes of all the attributes of expr; and if this Cat.InnerFuncBody is paired with a Cat.FuncHead, then the distributed key also extends over the head's parameter names.

A Cat.InnerFuncBody specifies a simple value expression tree of named expression nodes, each of which is a tuple of one of its expr.\w+_exprs 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 Cat.InnerFuncBody directly corresponds to the default value of Cat.FuncHead and unconditionally results in the value Bool:false.

sys.Core.Type.Cat.ExprNodeSet

A Cat.ExprNodeSet is a Tuple that specifies a set of named value expression nodes. It is typically composed into a (|inner )(function|updater). Each tuple of a Cat.ExprNodeSet 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 Cat.ExprNodeSet has these 5 attributes:

sca_lit_exprs - Cat.ScaLitExprNodeSet

These are expression nodes that define (|quasi-)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.

sca_pr_lit_exprs - Cat.ScaPRLitExprNodeSet

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.

tup_lit_exprs - Cat.TupLitExprNodeSet

These are expression nodes that define (|quasi-)tuple literals.

rel_lit_exprs - Cat.RelLitExprNodeSet

These are expression nodes that define (|quasi-)relation literals.

func_invo_exprs - Cat.FuncInvoExprNodeSet

These are expression nodes that invoke (|inner )functions.

There is a distributed (unique) key over the name attributes of all of a Cat.ExprNodeSet's attributes. Its default value is empty.

sys.Core.Type.Cat.ScaLitExprNodeSet

A Cat.ScaLitExprNodeSet is a Relation that specifies a set of value expression nodes where each node is a hard-coded (|quasi-)scalar literal of one of a certain collection of system-defined core (|quasi-)scalar types (or subtype thereof).

A Cat.ScaLitExprNodeSet has these 3 attributes:

name - Cat.Name

This is the declared name of the expression node.

comment - Cat.Comment

This is an optional programmer comment about either the expression node or the expression node (sub-)tree it is the root of.

value - Scalar

This is the actual literal value that the expression node represents. That is, any Scalar value could be used here, but in practice that is either dialect-defined (what literals are supported), and possibly implementation defined/limited.

A Cat.ScaLitExprNodeSet has a unary (unique) key on the name attribute. Its default value is empty.

sys.Core.Type.Cat.ScaPRLitExprNodeSet

A Cat.ScaPRLitExprNodeSet is a Relation 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 Cat.ScaPRLitExprNodeSet has these 6 attributes:

name - Cat.Name

This is the declared name of the expression node.

comment - Cat.Comment

This is an optional programmer comment about either the expression node or the expression node (sub-)tree it is the root of.

is_quasi - Bool

This is Bool:true if the node denotes a quasi-scalar literal; it is Bool:false if the node just denotes a scalar literal.

type_name - Cat.NameChain

This is the name of the type that the (|quasi-)scalar value belongs to.

possrep_name - Cat.Name

This is the name of the possrep, of the type named by scalar_type_name, in terms of whose attributes the (|quasi-)scalar value is being selected.

possrep_attrs - Cat.NameExprMap

These are the attributes (names and values) of the possrep_name possrep of the (|quasi-)scalar literal.

A Cat.ScaPRLitExprNodeSet has a unary (unique) key on the name attribute. Its default value is empty.

sys.Core.Type.Cat.TupLitExprNodeSet

A Cat.TupLitExprNodeSet is a Relation that specifies a set of value expression nodes where each node represents a (|quasi-)tuple literal.

A Cat.TupLitExprNodeSet has these 4 attributes:

name - Cat.Name

This is the declared name of the expression node.

comment - Cat.Comment

This is an optional programmer comment about either the expression node or the expression node (sub-)tree it is the root of.

is_quasi - Bool

This is Bool:true if the node denotes a quasi-tuple literal; it is Bool:false if the node just denotes a tuple literal.

attrs - Cat.NameExprMap

These are the attributes (names and values) of the (|quasi-)tuple literal.

A Cat.TupLitExprNodeSet has a unary (unique) key on the name attribute. Its default value is empty.

sys.Core.Type.Cat.RelLitExprNodeSet

A Cat.RelLitExprNodeSet is a Relation that specifies a set of value expression nodes where each node represents a (|quasi-)relation literal.

A Cat.RelLitExprNodeSet has these 5 attributes:

name - Cat.Name

This is the declared name of the expression node.

comment - Cat.Comment

This is an optional programmer comment about either the expression node or the expression node (sub-)tree it is the root of.

is_quasi - Bool

This is Bool:true if the node denotes a quasi-relation literal; it is Bool:false if the node just denotes a relation literal.

head - Cat.SetOfName

These are the names of all of this (|quasi-)relation literal's attributes.

body - Cat.SetOfNameExprMap

These are the (|quasi-)tuples of the (|quasi-)relation literal.

A Cat.RelLitExprNodeSet has a unary (unique) key on the name attribute. Its default value is empty.

sys.Core.Type.Cat.FuncInvoExprNodeSet

A Cat.FuncInvoExprNodeSet is a Relation that specifies a set of value expression nodes where each node represents the result of invoking a named (|inner )function with specific arguments.

A Cat.FuncInvoExprNodeSet has these 4 attributes:

name - Cat.Name

This is the declared name of the expression node.

comment - Cat.Comment

This is an optional programmer comment about either the expression node or the expression node (sub-)tree it is the root of.

function - Cat.NameChain

This is the name of the (|inner )function being invoked.

args - Cat.NameExprMap

These are the arguments for the (|inner )function invocation. Each element defines one argument value, with the element name matching the invoked (|inner )function's parameter name, and the element expr naming another local expression node which defines the value.

A Cat.FuncInvoExprNodeSet has a unary (unique) key on the name attribute. Its default value is empty.

sys.Core.Type.Cat.InnerUpdBody

A Cat.InnerUpdBody is a Tuple. It specifies the entire body or implementation of an inner updater (or the main body of a updater), besides the details that a Cat.UpdHead has, one of which each Cat.InnerUpdBody typically must be paired with.

A Cat.InnerUpdBody has these 3 attributes:

comment - Cat.Comment

This is an optional programmer comment about the (|inner )updater body.

exprs - Cat.ExprNodeSet

This defines the expression trees that are arguments to the update operators that stmt invokes. These expression trees must reference all of the parameters that the inner update operator has.

stmt - Cat.MultiUpdStmt

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.

There is a distributed (unique) key over the name attributes of all the attributes of exprs; and if this Cat.InnerUpdBody is paired with a Cat.UpdHead, then the distributed key also extends over the head's parameter names.

The default value of Cat.InnerUpdBody directly corresponds to the default value of Cat.UpdHead and unconditionally updates its topic argument to the value Bool:false.

sys.Core.Type.Cat.MultiUpdStmt

A Cat.MultiUpdStmt is a Relation 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 Cat.MultiUpdStmt, 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 Cat.MultiUpdStmt, 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 Cat.MultiUpdStmt has these 4 attributes:

comment - Cat.Comment

This is an optional programmer comment about the single update statement as a whole.

updater - Cat.NameChain

This is the name of the (|inner )updater being invoked.

upd_args - Cat.NameExprMap

These are the 1..N subject-to-update arguments to the (|inner )updater invocation, as-per ro_args. But since each expression tree in upd_args 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.

ro_args - Cat.NameExprMap

These are the 0..N read-only arguments to the (|inner )updater invocation. Each element defines one argument value, with the element name matching the invoked routine's parameter name, and the element expr naming a local expression node (or parameter) which defines the value.

There is a distributed (unique) key over the name attributes of upd_args and ro_args.

The default value of Cat.MultiUpdStmt directly corresponds to the default value of Cat.InnerUpdBody and unconditionally updates its containing (|inner )updater's topic argument to the value Bool:false.

sys.Core.Type.Cat.InnerProcBody

A Cat.InnerProcBody is a Tuple. It specifies the entire body or implementation of an inner procedure (or the main body of a procedure), besides the details that a Cat.ProcHead has, one of which each Cat.InnerProcBody typically must be paired with.

A Cat.InnerProcBody has these 3 attributes:

comment - Cat.Comment

This is an optional programmer comment about the (|inner )procedure body.

vars - Cat.NameTypeMap

This defines the 0..N (non-parameter) lexical variables of the (|inner )procedure; they initialize to the default values of their declared types.

stmts - Cat.SeqOfProcStmt

This defines the entire main body of the (|inner )procedure, which is composed of 0..N procedure statements. These statements must reference all of the parameters and lexical variables that the (|inner )procedure has.

There is a distributed (unique) key over the name attributes of all the attributes of vars; and if this Cat.InnerProcBody is paired with a Cat.ProcHead, then the distributed key also extends over the head's parameter names.

The default value of Cat.InnerProcBody directly corresponds to the default value of Cat.ProcHead and is a no-op, having zero statements.

sys.Core.Type.Cat.SeqOfProcStmt

A Cat.SeqOfProcStmt is a Seq whose value attribute has a declared type of Cat.ProcStmt.

sys.Core.Type.Cat.ProcStmt

A Cat.ProcStmt is a Tuple. It specifies a generic statement from which non-implicitly-atomic procedural Muldis D code is composed. Only (|inner )procedure may contain Cat.ProcStmt.

A Cat.ProcStmt has these 4 attributes:

comment - Cat.Comment

This is an optional programmer comment about the statement as a whole.

procedure - Cat.NameChain

Every procedure statement is an invocation of some other procedural routine (eg, procedure, update operator, system service), either user-defined or system-defined; this is the name of that routine.

upd_args - Cat.NameExprMap

These are the 0..N subject-to-update arguments to the routine invocation, as-per ro_args.

ro_args - Cat.NameExprMap

These are the 0..N read-only arguments to the routine invocation. Each element defines one argument value, with the element name matching the invoked routine's parameter name, and the element expr naming a local or global variable or statement-containing routine parameter which defines the value.

There is a distributed (unique) key over the name attributes of upd_args and ro_args.

The default value of Cat.ProcStmt will invoke sys.Core.Universal.assign, giving it arguments from same-named and typed parameters.

SIMPLE GENERIC CATALOG COLLECTION TYPES ^

sys.Core.Type.Cat.NameTypeMap

A Cat.NameTypeMap is a Relation. 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 heading), and it is used also for the components list of a scalar possrep. It is also used to define parameter lists for routines. A Cat.NameTypeMap has 2 attributes, name (a Cat.Name) and type (a Cat.NameChain); the name is the declared name of the attribute or parameter, and comprises a unary key; the type is the declared data type of the attribute or parameter. Its default value has zero tuples.

sys.Core.Type.Cat.NameExprMap

A Cat.NameExprMap is a Relation. 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 Cat.NameExprMap defines a whole Tuple value. It is also used to define argument lists for routine invocations. A Cat.NameExprMap has 2 attributes, name (a Cat.Name) and expr (a Cat.NameChain); the name is the name of the tuple/etc attribute or routine argument, and comprises a unary key; the expr 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 expr attribute could conceivably just be a Cat.Name because most of its allowed values would be in the lex namespace, the Cat.NameChain is used instead so that value expressions can take advantage of terse syntax for addressing value attributes. Its default value has zero tuples.

sys.Core.Type.Cat.AttrRenameMap

A Cat.AttrRenameMap is a Relation. It is used as a specification for how to rename attributes of some collection. A Cat.AttrRenameMap has 2 attributes, before and after, each of those being a Cat.Name, and each of those being a unary key. Its default value has zero tuples.

sys.Core.Type.Cat.SetOfName

A Cat.SetOfName is a Set whose value attribute has a declared type of Cat.Name.

sys.Core.Type.Cat.SetOfNameExprMap

A Cat.SetOfNameExprMap is a Set whose value attribute has a declared type of Cat.NameExprMap.

OLD TYPE DEFINITIONS TO REWRITE OR REPLACE ^

sys.Core.Type.Cat.E_TK

A Cat.E_TK (type kind) is a scalar enumeration consisting of the 8 values Cat.E_TK:special (mainly for system-defined implicit supertypes), Cat.E_TK:scalar, Cat.E_TK:tuple, Cat.E_TK:relation, Cat.E_TK:quasi_scalar, Cat.E_TK:quasi_tuple, Cat.E_TK:quasi_relation, Cat.E_TK:remnant. Its default value is Cat.E_TK:scalar.

sys.Core.Type.Cat.E_TDM

A Cat.E_TDM (type definition method) is a scalar enumeration consisting of the 9 values Cat.E_TDM:special (for some system-defined types that don't best fit in other categories, and all parameterized types; users can not define the latter for now), Cat.E_TDM:root (complete root type defined in terms of explicit attribute collection; all are fully defined, not parameterized), Cat.E_TDM:restriction (defined as "explicit other-type where condition"), Cat.E_TDM:alias (so the same one type can have multiple names), Cat.E_TDM:(union|intersection|exclusion) (defined as explicit union|intersection|exclusion of other types), Cat.E_TDM:difference (defined as explicit difference of 2 other types), Cat.E_TDM:negation (defined as explicit negation of another type). Its default value is Cat.E_TDM:alias.

sys.Core.Type.Cat.Type

A Cat.Type is a Tuple. It defines a data type, which can either be (sometimes) invoked directly for values, or be invoked by or embedded into other type definitions. Cat.Type is used in the catalogs for defining both system and user types (just the interfaces in the former case).

TODO: The catalog types for type definitions need an overhaul.

A Cat.Type has these 8 attributes:

tk - Cat.E_TK

This broadly declares what kind of type this is (eg, scalar|tuple|relation); it partially says how to interpret the rest of the attributes and/or which of them have significant values.

tdm - Cat.E_TDM

This is the type definition method for the type; it partially says how to interpret the rest of the attributes and/or which of them have significant values. If tk is Cat.E_TK:special, then tdm must be Cat.E_TDM:special; tdm can be special at other times too.

types - Cat.SetOfNameChain

For some values of tdm, the data type is defined at least partially in terms of other data types not by way of attribute definitions, and then types lists all/most of those types. Iff tdm is Cat.E_TDM:alias, then the data type is just a symbolic reference for some other data type (as far as the type system is concerned, they are the same data type, invokable by an extra name), and types has one element that is the name of that type. Iff tdm is Cat.E_TDM:restriction, then the data type is defined as an explicit subtype of another type by way of an explicit further type constraint applied to it, and types has one element that is the name of that supertype. Iff tdm is Cat.E_TDM:(union|intersection|exclusion), then the data type is defined as an explicit union|intersection|exclusion of N other types, and types lists their names, one per element; 2+ elements is the norm; just 1 element means that the data type is a simple alias for the named element; zero elements means the data type is a simple alias for, respectively, the type Empty, Universal, or Empty. Iff tdm is Cat.E_TDM.difference, then the data type is defined as the difference of 2 other types, and types has one element that is the name of the minuend type. Iff tdm is Cat.E_TDM.negation, then the data type is defined as the negation of some other type, and types has one element that is the name of that type.

subtr_type - Cat.NameChain

Iff tdm is Cat.E_TDM.difference, then the data type is defined as the difference of 2 other types, and subtr_type is the name of the subtrahend type.

attrs - Cat.NameTypeMap

Iff tdm is Cat.E_TDM:root, then the data type is defined fundamentally in terms of an explicit attribute collection, and attrs defines the names and declared types of those attributes. Iff additionally tk is Cat.E_TK:(scalar|quasi_scalar), then attrs specifically defines the attributes of just the core/initial/only possrep; otherwise, attrs defines the heading of the tuple or relation etc type. It is valid to have zero attributes; in this case, the type consists of exactly one value.

keys - Cat.SetOfSetOfName

Iff tk is Cat.E_TK:(relation|quasi_relation) and tdm is not Cat.E_TDM:special, then the data type is or resembles a relation type and can have explicit keys (duality of unique key constraints and terser unique identifiers for the q/relation's member q/tuples) defined over its attributes, and keys defines those keys in the canonical simplest form (in contrast with using constraint instead). Each element of keys defines one key of the q/relation, and that element is a set of the attribute names comprising that key. For q/relation types, if no keys are explicitly defined, then it implicitly has a single key comprising all of its attributes. 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 q/relation type, and values of the type may each consist of no more than one tuple.

constraint - Cat.TypeConstraint ... default one always res True

Iff tdm is Cat.E_TDM:root, then the data type is defined fundamentally in terms of an explicit attribute collection, and constraint defines/names a generalized type constraint that validates the collection as a whole. Iff tdm is Cat.E_TDM:restriction, then the data type is defined as an explicit subtype of another type by way of an explicit further type constraint applied to it, and constraint defines/names that further constraint.

comment - Cat.Comment

This is an optional programmer comment about the data type.

The default value of Cat.Type is an alias of Empty.

sys.Core.Type.Cat.Exception

TODO.

sys.Core.Type.Cat.SetOfSetOfName

A Cat.SetOfSetOfName is a Set whose value attribute has a declared type of Cat.SetOfName.

sys.Core.Type.Cat.SetOfNameChain

A Cat.SetOfNameChain is a Set whose value attribute has a declared type of Cat.NameChain.

SYSTEM-DEFINED CORE QUASI-CATALOG PARAMETERIZED TYPES ^

These types are incomplete proper subtypes of other core incomplete types, and generally speaking their sole purpose is to be the declared data types of several system-defined N-ary tuple|relation operator parameters which are collections of generic nonscalar values. They are called quasi-catalog because they are not generally expected to be used for user data, but they also are not used to compose the system catalog either.

sys.Core.Type.QuasiCat.(Set|Bag)Of(Tuple|Relation)

A (Set|Bag)OfRelation is an incompletely defined proper subtype of Set|Bag whose value attribute has a declared type of a Tuple|Relation subtype; this is the parameter type of several N-ary relational operators.

sys.Core.Type.QuasiCat.SetOfBag

A SetOfBag is an incompletely defined proper subtype of Set whose value attribute has a declared type of a Bag subtype; this is the parameter type of several N-ary relational operators that work with Bag values.

sys.Core.Type.QuasiCat.MaybeOfTuple

A MaybeOfTuple is an incompletely defined proper subtype of Maybe whose value attribute has a declared type of a Tuple subtype; this is the parameter type of the sys.Nonscalar.Relation.maybe_reduction operator.

sys.Core.Type.QuasiCat.SeqOfSeq

A SeqOfSeq is an incompletely defined proper subtype of Seq whose value attribute has a declared type of a Seq subtype; this is the parameter type of the N-ary sys.Sequence.catenation operator.

sys.Core.Type.QuasiCat.QuasiSetOf(Tuple|Relation)

A QuasiSetOfRelation is an incompletely defined proper subtype of QuasiSet whose value attribute has a declared type of Tuple|Relation; these are the parameter types of the N-ary sys.Core.Tuple.product and sys.Core.Relation.(join|product) operators.

SEE ALSO ^

Go to Muldis::D for the majority of distribution-internal references, and Muldis::D::SeeAlso for the majority of distribution-external references.

AUTHOR ^

Darren Duncan (perl@DarrenDuncan.net)

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 Muldis::D for details.

TRADEMARK POLICY ^

The TRADEMARK POLICY in Muldis::D applies to this file too.

ACKNOWLEDGEMENTS ^

The ACKNOWLEDGEMENTS in Muldis::D apply to this file too.