Mike Austin's Blog

Tuesday, November 11, 2008

Impulse: C++

One of the goals of Impulse is to make bindings and glue code easy to write. Taking advantage of type constructors and operator overloading in C++, you can create a dynamic "language" that's fairly small:
val n = val(5) (pow_, 2);

range(1, 5) lambda (each_,
cout << args[0] << endl;
)
The first line above without sugar would be:
val a = { 2 }, Args args(&a[0], &a[1]);
val n = val(5).perform(_pow_, args);
Eeek! The second? well... let's not go there :) Actually, it's not bad - just 1 nested class macro.

0 Comments:

Post a Comment

<< Home