Version 43 (modified by archibald, 8 years ago) (diff) |
---|
Table of Contents
ClassDefinition
CompileTimeTypeChecking
DataTypes
EnterTheIdeaBase
EnumDefinition
ExpressionSyntax
FiniteStateMachines
NotationExplaination
SignalDefinition
SingletonDefinition
TypeDefinition
WhatAboutIdentifiers
compoundStatementsLlambdas
1) Namespaces
Namespaces : Context
We need to create name spaces.
Namespaces are
- a labeled/named subset of identified/labeled content,
- content can then be precisely identified with a compound identfier
- the conjuction of the subset name and the content name.
- commonly structured as nested hierarchies to allow reuse of names in different contexts.
- typically employed for the purpose of grouping symbols and identifiers around a particular functionality
- to avoid name collisions between multiple identifiers that share the same name.
- hierarchical, ie sets of namespaces can be nested within another namespace
Namespaces : Examples
In TDX
NAMESPACE $project
Puts anything following in the current project context
NAMESPACE $project:subComponent
OR
NAMESPACE subComponent
Puts everyting that follows into the project's subComponent namespace
NAMESPACE subComponent - $system:language
OR
NAMESPACE subComponent - language
OR
NAMESPACE subComponent - $dxlib:codelib
Puts everything that follows into the project's subComponent namespace AND incorporates the system defined "language" namespace contents accessible to the project.
NB.
The default namespace is $project and coresponds to the base directory of the current project.
The default namespace to be included is $system and coresponds to a file refererd to by the dxiner environment variable.
If any other $name is used, it coresponds to a system based environment variable containing a directory where the coresponding ".tdx" file can be found. The variable can consist of a selection of paths, separated by semi-colons.
In VDX
Namespaces : Semantics
Namespaces : Data Definition
To store namespaces we need a structure similar to that detailed below ... explaination of the notation
In TDX
NAMESPACE $project:tdx - $system:lang // however $project is implied and not really needed SINGLETON design namespace ourNameSpaces = NEW namespace("system") SYNTAX textualDesignClause := ( designClause )+; designClause := namespaceClause ( designComponentClause )+; designComponentClause := ... ; CLASS namespace(ubyte$ name) namespace{} subSpaces namespace(namespace) addNamespace(newNameSpace) = { subSpaces->add(newNameSpace) RETURN newNameSpace } SYNTAX namespaceClause := "NAMESPACE" newNameSpaceClause ( "-" ( existingNameClause )+ ); newNameSpaceClause := ( "$" ident ( ":" ident )* | ident ( ":" ident )+ ); existingNameClause := ( "$" ident ( ":" ident )* | ident ( ":" ident )+ );
In VDX
Namespaces : Syntax
INFORMATION MODEL
PROCEDURAL MODEL
(1.1) Data Types
(2) Types
(3) Enums
(4) Signals
(5) Singletons
(6) Classes
(7) Expression Syntax
(7.1) What about identifiers (Expression Syntax) ?
(7.2) Compile Time Type Checking
Attachments
- existingNamespaceClause.png (28.1 KB) - added by archibald 8 years ago.
- namespaceClause.png (15.1 KB) - added by archibald 8 years ago.
- newNamespaceClause.png (27.0 KB) - added by archibald 8 years ago.
- namespace.png (27.4 KB) - added by archibald 8 years ago.