Main features of the Transd programming language

Below is a list of main properties, capabilities and elements of Transd programming language. Most of entries are provided with examples from the language test suite. All example files can be downloaded and run in the Transd command line interpreter.

Type safety

Transd is statically typed: the types of all expressions and variables in a Transd program are known before the run-time phase begins. This greatly increases the robustness of programs, helps in early detection of bugs and improves the language perfomance.


All code in Transd programs is organized into modules. Modules serve for logical grouping of code and isolation of program parts. A source file can contain several modules, and a module can be defined in several source files. A module can be private or public. The contents of public modules are accessible to other modules. The contents of private modules are inaccessible and invisible by default to other modules, but access to some or all module members can be explicitly granted to some or all other modules.
Demo1: 'graph' program, Demo2: '' test file.


Transd supports object-oriented programming style and offers the mechanism of classes as templates for new objects.
Demo: 'graph' program.

First-class functions

Functions in Transd have very much in common with data and can be passed as parameters to, and returned from other functions.
Demo1:, Demo2:, Demo3:

Generic collections

Transd type system includes parameterized, or compound, types (sometimes called "generics"). Container types in Transd (vectors, associative arrays) are only allowed to contain elements of one type, which is specified at container's creation: for example, Vector<Int>. This drastically increases safety and speed of programs, and comprehensibility of program texts.
Demo1:, Demo2:

Built-in data queries and table processing

Transd has powerful built-in capabilities for data processing. It has integrated SQL-like data query language, as well as built-in functionality for working with tabular data. One can compare two ways of working with the same tabular data in test files: Demo1: Demo2:


Typed tuples can be used for storing together objects of different types. This makes work with differently typed elements, e.g. with tables, more safe and convenient. A table record can contain fields of different types (strings, numbers, etc.). For example, a table contains records with two fields: a string and a number. One can define a typed Tuple:

Tuple<String Int>

then put each record of the table into such tuple, and store all tuples into a vector:

Vector<Tuple<String Int>>>

And this vector will be sortable by any of the tuple's fields! That is we get a mini-database with so little work! An example of this Transd's functionality can be seen in:


Filters is a tool for working with collections and ranges. They are used for applying a function to all or some elements of a collection or range. A filter object is created with two parameters: an input sequence and the action to apply to each element of the sequence. Optionally, a third parameter can be added: a function, which selects (filters) elements in the sequence to which the action should be applyed.
Demo1:, Demo2:


The powerful mechanism of error reporting is also present in Transd.

Dynamic module loading

Transd has two ways of dynamically accessing from a running Transd program the functionality of other Transd libraries: via running a program and via module loading. The first variant loads the library and all its dependencies into its own separate name space. The second - into the namespace of the main program where the library uses already loaded modules and can do useful job on the shared data, and then it can be unloaded for freeing memory or to avoid name clashes.

This mechanism is at work in the Transd testing framework: the driver program runs test files one by one: a test file is loaded, it runs its tests in the shared namespace, so that it can update shared variables, and then it's unloaded, making it possible to run a next test file, which has the same module name.
Demo1:, Demo2:

Code as data

The 'eval' function can be used for interpreting a text string as code and run it. This feature is used in the command line interpreter for evaluating Transd expressions entered from the command line.


Ranges are used to define intervals in sequences, be it a number sequence or a sequence container.
Demo1:, Demo2:

Type aliases

Type aliases make it more convenient to work with long type names of compound types. For example, one can create the "Record" alias for a typed Tuple:

Tuple<String Int String Double String>>>

Such alias can be used everywhere instead of the original type name.


Strings are a built-in type in Transd. They have usual string operations, support regular expressions and offer some enhancements, such as, for example, the syntax of the "substring" operation. E.g. if we have the following string:

s: "/home/user/.local/bin/"

Then the function call

(substr s from: after: last: "/" to: last: ".")

will return "scriptname".


Transd offers another syntactic novelty: it extends the usual function call syntax with the concept of 'markers'. A marker is an auxilliary token in a function call with colon at the start or at the end. In some cases they resemble parameter names, but as the previous example shows they have much wider use.