Home | About | Partners | Contact Us

SourceForge Logo

Quick Links
Building XL
XL Mailing List

Understanding XL
Conceptual overview
XL examples
Inside XL
Concept Programming

In depth
Browse GIT
SourceForge Info

Other projects
GNU Project
The Mozart Project

XLR: Extensible Language and Runtime

The art of turning ideas into code

Language extensions

Prev: Generics validation


Next: Pragmas

One of the key ideas of Concept Programming is that the set of useful concepts isn't restricted in any ways. A good programming language needs to accomodate this diversity, and make sure that all concepts can easily be represented in the code space.

Historically, programming languages have featured specific set of abstraction mechanisms to achieve some form of extensibility. A large number of programming languages such as C or Pascal make it easy to give names to procedures and functions. (As an aside, this may be taken as a given by all programmers today, but this wasn't always available. Most early versions of BASIC available on early 8-bit microcomputer forced you to reference subroutines by line number, and had no mechanism for passing arguments, forcing programmers to use global variables as a communication mechanism. I still remember the thrill of discovering that the "Advanced BASIC" of the Sinclair QL allowed named procedures and functions with local parameters: it was like adding new keywords yourself! End of old geezer's rant... but hold that thought, the example is not as gratuitous as it sounds)

Subroutines, templates, operator overloading and macros are all forms of language extension. But these mechanisms work within rather constrained semantics limits, so they cannot represent arbitrary concepts. For instance, using C-style functions alone, one cannot implement a representation of tasking that is remotely as convenient as Ada's tasking features. Instead, C programmers need to resort to libraries like pthreads, which features a much poorer semantics. As an example, passing parameters between tasks (threads) using pthreads brings you back to the old days of passing data using global variables (shared memory), whereas Ada's rendez-vous feature parameter passing semantics very similar to that of subroutines.

The XL extension model is more general, being based on general-purpose translation mechanisms in the compiler. The main validation of these mechanisms is that they are implemented to implement all basic features in XL, from functions to generics to objects. But the same mechanism can be used to implement not only tasking but logic programming or symbolic differentiation.

One concern with language extensions is that they create dialects. Pragmas are one possible approach to alleviate this problem.

Prev: Generics validation


Next: Pragmas

Copyright 2008 Christophe de Dinechin (Blog)
E-mail: XL Mailing List (polluted by spam, unfortunately)