Home | About | Partners | Contact Us

SourceForge Logo

Quick Links
Home
News
Status
Building XL
XL Mailing List

Understanding XL
Conceptual overview
XL examples
Inside XL
Concept Programming

In depth
Browse GIT
Bugs
SourceForge Info
Contact

Other projects
GNU Project
The Mozart Project

XLR: Extensible Language and Runtime

The art of turning ideas into code

Concept cast

Prev: Concept Representations

Up

Next: An unlimited set of concepts

A concept cast happens when a particular concept cannot be represented, and the programmer uses instead a closely related concept as a workaround.

For instance, C doesn't have a real notion of array. Instead, it uses pointers. A concept cast like this introduces semantic noise. In that example, the notation A[B] in C is really a shortcut for *(A+B). This makes it very easy to access elements outside the bounds of the array, and overwriting random memory (a frequent source of bugs in C, known as buffer overrun). Another side effect is that it is legal in C to write 1[A] to access the first element of the array, or even -1[A+2]. These notations, however, are somewhat surprising and hard to decode. They are not complicated per-se, but because they have no correspondance in the problem space.

Prev: Concept Representations

Up

Next: An unlimited set of concepts


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