Wednesday, 5 March 2008

Lisaac

A few days ago, after surfing through some programing languages topic on wikipedia , I suddenly found myself looking into this new object oriented programing language called Lisaac.

Lisaac is the product of the Isaac Project, currently a small but with very ambitious goals project, that goes from designing, developing and implementing a new operating system up to the design and development of a new prototype-based object oriented language in which this operating system could then be written.

I think that the computer science and software community pretty much agree that we have been kind of stuck with very old-fashioned operating system design for a while now (Do I hear Alan Kay's saying : "no innovation in the last 20 years"?) , and there have been many efforts to address most of these issues through different projects since long time, efforts that goes from very well known and old projects like the GNU/Hurd , and more recent projects like House , each of them trying to come up with the last innovation to move forward to a 'better OS world'. And this concern is really not something new , we could track it back to the 60's or 70's with the Lisp machines or with the firsts Smalltalk systems where we could for example still easily debate if it is an operating system or a programing language (or and IDE, or a collection of classes, or an alive object system, or all of that, or more than that!) , but it seems like somewhere in the road , the communities have made mistakes that avoid these kind of innovations coming upstream.

We can also look at this from another perspective , let's better blame us for being ourselves so addicted to the Unix-like model? , even those who hates this model, end up using it on a daily-forever basis, and deeper inside probably love it too.

So, what happens?

If you have read so far until this line, I might be giving the impression I have the answer for this question , and that I finally found the way of solving the new-OS projects stagnation problems .... well, no, I really don't ..... but, what I can and I am actually doing right now is to point some interest to new projects and efforts , like this one called Isaac/Lisaac.

Briefly speaking, Isaac is intended to be a fully standalone operating system designed with a prototype object oriented model , and for this, the following approach has been taken: Developing a whole new high-level compilable prototype-based object oriented language with low-level capabilities and easy C interfacing. And we get Lisaac.

Lisaac is the language with all the previously mentioned characteristics in which this new OS is being written.

This kind of Language-System design approach offers many advantages, one of them is that helps to abstract low level components very easily into a high counterpart , for example, Isaac is composed only of pure prototype objects , things like 'files' and 'processes' disappear, we deal with the operating system components as we would deal with any other object in the user level applications.

Lisaac has been modeled after 3 well-known languages mainly:
  • Smalltalk: as dynamic as possible.
  • Self: No class, only prototypes.
  • Eiffel: the language from which it inherits the most; static typing , design by contract, multiple inheritance and more.
The Lisaac's syntax resembles pretty much a mix of Eiffel and C , with a simple Smalltalk semantic ; since _everything_ is an object, all the communication between these objects go through messages sending. Even the 'if' construct is a message defined in terms of the TRUE and FALSE objects. Other interesting and handy feature is the nice interfacing with C; in Lisaac a backquoted expression like `printf("hello world\n")` is a way of making the compiler to jump into C code directly, this is a reasonable feature considering one of the main purpose of this language (writing an OS) and one of the easiest way of interfacing C code available in a so distinct language from C itself.

As a side note, both the Isaac and Lisaac projects are sponsored by several research labs and organizations and their development are intended to be very open to the software community, for example Lisaac is released under the GPLv3 (Isaac is released under a different special license though).

The latest version of the language is 0.13.1 , and though I have found some bugs here and there on this latest implementation, the development seems very active and the basic features are working very good, you can check for further information about the current status of the implementation and even download it from this page, this latest implementation has also been recently made available for Gentoo users through portage, so you can get it with a simple 'emerge lisaac' too on these systems. Other nice thing about Lisaac is its good compatibility with GCC , so you can get it working without problems (or not too much) into a GCC capable system.

The current implementation is invoked with a simple 'lisaac foo.li' command, where foo.li is a lisaac source code file, and it will generate a C file, foo.c which is automatically linked into an executable.

Though I have not tried it myself, but it seems functioning in its first stage according to the site and reports, you can already download and test an initial version of IsaacOS from here.

Well, too much talking for now, let's show some code. This is the Lisaac version of the (in)famous '99 bottles of beer!' song. :-)

Enjoy and Cheers!

// Code starts here.
Section Header

+ name := BOTTLES;
- author := "Luis Araujo";
- comment := "The cool song 99 bottles of beer!";

Section Private

+ b : STRING_CONSTANT := " bottles ";

Section Public

- main <-
(
+ v : INTEGER;
99.downto 1 do { i : INTEGER;
i.print;
(b + "of beer on the wall, ").print;
i.print;
(b + "of beer.\nTake one down and pass it around, ").print;

v := i - 1;
(v = 0).if {
"no more bottles of beer on the wall.".print;
"\n\nNo more bottles of beer on the wall, no more bottles of beer.".print;
"\nGo to the store and buy some more, 99 bottles of beer on the wall.\n".print;
} else {
v.print;
(v == 1).if_true {
b := " bottle ";
};
(b + "of beer on the wall.\n\n").print;
};
};
);

5 comments:

David Leoni said...

The Coyotos project seems more interesting to me, they're trying to build a provable *and* efficient OS rather then a simply object based one. Obviously, they admit their goal may be quite unrealistic, but at least it is an effort in that direction. They're developing the new language BitC to do the job, which is an interesting mixture of Scheme/ML and ACL2, thought to cope with fixed memory representation and provability.

araujo said...

I hadn't checked the Coyotos project since a while now, I just remember some comments and proposals to make it the official kernel for the Hurd project ; more than that, I am not much into it, but it is good to see it is under heavy development too.

As for the efficient part, I had to point out that Lissac currently performances better than most of the programing languages implementations according to the language shootout, and it is clearly also a goal of the Lissac project to offer a robust, fast and scalable system. Also notice how Lissac is the language in which the OS (Issac) is being written, but it isn't tied to it in any way, in other words, it is a whole general purpose OS-independent programing language from the ground.

Thanks for posting this comment, I will surely take a closer look into coyotos and bitc (which I hadn't heard of yet)

Friedrich said...

Well the "easy integration" may have been borrowed from Q, or maybe not who nows, here's some code I once wrote for accesising the file system via Q -> C

c_open_directory(pathname: Mutable_string)
-- open a directory for getting all the file and directory names in it
external C_EMBED
source
"char *dir_name = (char*) ", `pathname.storage`, ";", \n
" DIR *dir = opendir(dir_name);", \n
" if (dir == NULL) {", \n
" ", `error_code`, " = errno;", \n
" }", \n
" ", `dir_ptr`, " = (_q_PointerV) dir;"

end

What the do not seem to have borrowed was the idea of a sliding loop construct


if file_info.is_directory then
fsc := new Unix_file_system_commands;
fsc.initialize;
owd := fsc.current_working_directory;
fsc.change_directory(path_name);
fsc.open_directory((".").mutable_string);
loop until not fsc.is_directory_open
fsc.next_directory_entry;
if fsc.is_directory_open then
fsc.remove(fsc.directory_entry);
endif
endloop;
error.print_string("owd = ");
error.print_mutable_string(owd);
error.print_string(", will remove ");
error.print_mutable_string(path_name);
error.print_newline;
fsc.change_directory(owd);
fsc.remove_directory(path_name);

or another way

loop
xxxxxxx
until end_of_loop_condition
endloop


We have thought about a follow-up to Eiffel with extending the strength of it and avoiding the weaknesses.

We were thinking that "programming-in-the-large" can better be done in an OO-Fashion but the Algorithms do need much better "functional" support.

And we were trying to make the DBC better, because the functions could not have side-effect they never coulc have altered the pre and postconditions. And a language withou the facility to give around functions is IMHO lacking very much.

Unfortunatly we never have published Q, because we were thinking that people would have been willing to pay for "well-designed" languages. Oh man, were we mistaken ;-(

Lisaac is very much in the spririt of Q. However it's programming model is simply better, and simply simpler ;-)

Regards
Friedrich

araujo said...

Hello Friedrich,

As you say in your post that you have never published Q , I am wondering if you are talking about a language other than http://q-lang.sourceforge.net/ ?

I have never looked into this Q language either, though glancing over its site, it sees like a nice dynamic symbolic language (resembling pretty much Haskell ... interesting) ; so I am not sure what language you are referring to.

Thanks and Regards,

Friedrich said...

I did know that there are a few Q languages out there but ours is not publicy available. So it surely is not on sourceforge. I just mentioned it because of the easy Lisaac/C integration. Which we had added to Q around 2000 ;-)

Regards
Friedrich