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

Concept Representations

Prev: signal/noise ratio


Next: Concept casts

Programmers do not manipulate any concept directly. They deal with concept representations. There is an unlimited number of ways to represent a same concept into code, and these representations have different benefits and drawbacks for the programmers. Concept Programming proposes a set of metrics to evaluate how appropriate a particular representation is.

Consider the concept of addition as an example. Across different languages, not only can the addition of A and B can be written in a variety of ways (different syntax), but it can also behave very differently (different semantics).

Assembly language ADD A, B A mnemonic for a processor operation
C A+B A built-in operator on built-in types, normally implemented using one of the processor operations
Java A+B A built-in operator on built-in types, with identical results irrespective of the processor operation
C, Java Add(A, B) For user-defined types, many languages require a function call
C++ A+B
C++ operators are similar to C for built-in types, but can be extended for user-defined types
Smalltalk A+B Send to object A the message "+" with B as an argument.
XL operators are reduced to function calls using pattern matching. The standard library includes functions or types to represent native processor operations or types.

All these syntax and semantics variants for the addition are different representations of the same concept. Because they are different, these representations don't have the same properties for the programmer. For example, C programmers need to worry about changes in the number of bits used to compute the addition when the code moves from platform to platform, while Java or XL programmers don't.

The syntax itself generally matters very little in the long term, as long as it is not completely inane or ambiguous. But the semantics may have a profound effect on how well the code represents the concept, or on how easy it is to maintain or understand. This is true for any concept, from the simplest to the most complicated.

Prev: signal/noise ratio


Next: Concept casts

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