|
|
|
|
Quick Links
Understanding XL
In depth
Other projects
|
XLR: Extensible Language and Runtime
|
Like several languages before it, notably Ada and C++, XL features generic entities. From a semantics point of view, XL generics are closer to C++ templates than to Ada generics. In particular, XL features implicit and transitive instantiation, which are a key requirement for advanced template libraries similar to the C++ STL. Instead of using the < separator for generic parameter or arguments, XL uses a block notation delimited with angle brackets [ ].
// Simple example of generic type declaration generic [index : range; value : type] type array written array[index] of value Cards : array[1..52] of card Frequency : array['A'..'Z', integer] There are a few aspects of XL generics that might surprise C++ or Ada programmers.
Variadic entities are also considered a form of generic. Note: At this stage, only the C++ version of the XL compiler has any kind of support for generics.
|
Copyright 2008 Christophe de Dinechin (Blog)
E-mail: XL Mailing List (polluted by spam, unfortunately)