Thursday, January 20, 2005

Abstraction without losing the Details

In the recent proliferation of programming languages to handle the many specific internet domains, there have been languages that provide abstract ways to represent and manupulate computers for a variety of purposes. For example, Java has provided the virtual machine abstraction, allowing programmers to write a program that runs on a large number of platforms. The virtual machine abstraction reduces the control the programmer has over the machine however, and complex algorithms or data intensive processing fail in Java because of the memory and speed processing control constraints. The general trend toward more abstract languages points out an important need in the programming community: C (the language that major operating systems are written in these days) is too "low level" to quickly, spontaneously prototype and develop operating system independent programs. The benefits of quick development in abstract languages outweigh the control/speed advantages of C/C++ for most developers. So, why don't we have langauges that allow full control of the machine with the benefits of abstraction as well? The answer for me is to write a language that combines the control and speed benefits of C++ with the clean syntax and abstraction capabilities of Lisp. I'm currently working on a language on top of Lisp that writes C++ code and perform compilation with the GNU C++ compiler. The process of compilation and execution is abstracted. I'm hoping that this will help to speed up my development time to be as fast as any other Lisp program, while having the advantage of C++ speed and control. ANSI C++ is of course operating system independent, so the programs developed could be compiled on any platform that compiles ANSI C++ code.


At July 16, 2005 at 5:02 PM, Blogger Richard Cook said...

I think this approach isn't used more for a couple of reasons, both of which are related to the belief that most of an application's time is spent in a small part of the code.

In Common Lisp, especially some of the compiling implementations such as CMUCL and SBCL, when properly declaring types the resulting Lisp code can be close to C in speed.

When that isn't enough, the Common Lisps have good FFI's to C, giving access to libraries that have been crafted for years by the bit-twiddlers.

At December 16, 2005 at 12:04 PM, Blogger Bo Morgan said...

I would agree that some applications involve a lot of scripted processing where each function call in a script may take the significant portion of the processing time.

You are right that most of a script-like application's time is spent in a small percentage of the overall code, but if you are trying to write applications that are generally processor intensive a better solution is required.

My basic tenets here are:

(1) script functions are easily written in C.
(2) macroes, compilers, and languages are easily defined in Lisp.
(3) lisp is not as easy to use as C in terms of declaring typed data and operating over that data efficiently.

I am led to imagine a language that allows:

(1) easily written script functions,
(2) powerful macros (able to compile and execute arbitrary C code),
(3) easy to write new compilers and languages.
(4) includes a language that effectively makes writing efficient C code very easy.

I've heard that SBCL does produce good machine code when type declarations are used, but in terms of efficiency this exists on top of the SBCL memory management and typecasts.


Post a Comment

<< Home