Archive for September, 2008

Ecere SDK 0.43: Templates, Syntax Highlighting…

Wednesday, September 3rd, 2008

After a lot hard work, I am pleased to announce the release 0.43 of the Ecere SDK. Download links follow:

For Windows:

Ecere SDK 0.43 for Windows – September 3, 2008 (36 MB)

If you already have MinGW installed on your system (or if you already have an earlier version of the Ecere SDK installed), you can chose the following significantly smaller package instead. Note that it doesn’t contain GDB and UPX either.
Ecere SDK 0.43 (No MinGW/GDB/UPX) for Windows – September 3, 2008 (7 MB)
If you chose this smaller package, make sure that the MinGW executables are either in your PATH or in the IDE’s File/Global Settings/Executables paths so that they can be found by the build system. Also, the IDE will be looking for a “make.exe” (rather than a mingw-make.exe).

For Linux:

Ecere SDK 0.43 for Linux (Generic binaries) – September 3, 2008

Please read the INSTALL file for instructions on how to install the generic tarball and for general notes on operation under Linux.

Ecere SDK 0.43 for Debian/Ubuntu – September 3, 2008
The samples will be located in /usr/ecere/samples/ .

Ecere SDK 0.43 for GoboLinux – September 3, 2008
(Add to your official repository and run InstallPackage Ecere)
The samples will be located in /Programs/Ecere/0.43/samples/ .

Additions to the eC language

This release main highlights are class templates as well as standard collection (container) classes which have been added to the eC language. This functionality represents major work which had actually started in the the earlier releases as well, and finally is ready in this new version.


Class templates make possible generic/meta programming.

The approach of eC towards templates is unique in that it is completely dynamic. A template class is in fact declared the same way as (and no different from) a regular class, but specify “template parameters” to be parametrized. It is dynamic in that the class as it is can already deal with any parameters the class template could be used with, even if that parameter refers to for example a class not defined within the module of that template.

eC classes can exist within a shared library, or an eC source file and it can be used across multiple modules without the need for header files. The same is true for eC class templates, which do not require any additional compilation for use with different parameters. Only a single piece of code for the actual class templates and its functions exists, just like for any other eC class.

This “no recompilation” approach templates makes for smaller code size, but may scare some about its performance. However, in practice this should be minimal, since many optimizations are being applied, and more optimizations should come as we benchmark the eC dynamic templates approach. These new templates have worked and performed nothing but extremely well so far.

Classes can be parametrized using any number of three types of parameters: data types, expressions (e.g. specifying a constant value), as well as identifiers (Which can currently identifier a data member, but will be extended to properties and methods as well).

The templates are very powerful and support even complex cases with recursions as in the following example:

class A : B<A> { int a; }
class B<class T> { T test; }


The standard container classes included in this release are “typed” class templates to replace the previous “non typed” container classes (List, BinaryTree, and pseudo-template Array, which will be slowly phased out. In the meantime List has been renamed to “OldList”, Array to “OldArray”, and Link to “OldLink”). The new containers are all derived from a base “Container” class from which all containers should derive in order to benefit from generic iteration and new eC syntactic sugar. The provided default containers cover dynamic arrays through the new Array class, link lists through the new classes List and LinkList, associative arrays through the new class Map, as well as AVL trees (a particular type of self balancing binary tree) through the new classes AVLTree and CustomAVLTree. It is somewhat analogous to a subset of the Standard Template Library and its corresponding classes such as std::vector, std::list and std::map, though I believe eC’s approach is generally a lot more elegant.

The syntactic sugar for containers include the array notation, e.g. [ 1, 2, 3 ] to denote a container containing the three integers 1, 2 and 3. It also introduces a “foreach” syntax using the regular for keyword in a new way. The following will print all i in array which are greater than 1:

Array<int> array { [ 1, 2, 3 ] };
for(i : array; i > 1) PrintLn(i);

Notice how i (which takes the type of the array elements) does not need to be declared. Iterating can be done generically (not knowing what kind of container we’re dealing with) using the Iterator class, for example in the following manner:

Iterator<int> i { array };
while(i.Next()) PrintLn(;

The indexing operator can also be used directly with the container classes. The following example can be used to count the occurrences of strings, assuming it is repeatedly called with “s” being each string to count. Notice how wordCounts is indexed with “s”.

Map<String, int> wordCounts { };

The container classes can also be used to iterate through infinite collections, or through data contained outside the actual container class. Please look at the ContainersTest sample in the samples directory for additional examples, including iterating through the Fibonacci series.

Print / PrintLn

You might have noticed the PrintLn function which is now available to print to the standard output any data type followed by a newline. The equivalent function Print does the same without printing the new line. Furthermore, these functions can take any variable number of parameters which can be of different types, and it comes in various flavors (inside the File class, PrintBuf/PrintLnBuf, PrintString/PrintLnString). The following demonstrate the elegance of this new tool:

int a = 3, b = 4;
PrintLn(a, " + ", b, " = ", a + b);

 Other improvements

Another very enjoyable improvement is much improved syntax highlighting inside the IDE’s code editor, as well as some tweaks to the way the editor works which can be changed in the File/Global Settings dialog.

Many bug fixes and other issues were resolved inside the IDE, notably relating to the debugger integration. The debugging functionality should now be very useable under both Linux and Windows.

I’m also happy to provide new packages available for specific Linux distributions, such as Gobolinux (my personal favorite to which I switched my main development station – and Debian/Ubuntu.

Ecere Communicator as well as Acovel Media Player have been slightly updated for the new release, with some minor fixes along the way not justifying new versions. Here are the download links:

Acovel Media Player 0.01 for Windows
Acovel Media Player 0.01 for Linux

Ecere Communicator 0.02 for Windows
Ecere Communicator 0.02 for Linux