Logiweb(TM)

3.4 Comparison to C

Prev Up Next Page 22 of 800 Search internet


Logiweb has a few things in common with C and also has a C interface.

Headers and libraries

In C, one typically gets access to a library function by including one header file and linking in one library. Logiweb pages correspond to C libraries and Logiweb pages include name and charge definitions which make the header files obsolete.

In C, using a library function involves an #include in the source file and an -l option at the link stage. In lgs, one just needs an ""R in the source file.

The C stdio library versus the Logiweb base page

Isolation of I/O and other elementary routines to a <stdio.h> header and a libc library constituted a great step forward in C. In Logiweb, that approach is taken one step further by putting almost all of the language into a base page. The only features remaining in the core language are the features for referencing pages like the base page, for defining new syntax, and a few others.

That approach provides authors with a maximum of flexibility for customizing the language.

C identifiers versus Logiweb constructs

C identifiers have the advantage of being case sensitive as opposed to Lisp and several other, early programming languages. Logiweb constructs are also case sensitive. Furthermore, Logiweb constructs can contain arbitrary Unicode characters except the double quote character which is the only reserved character in lgs.

In some sense, allowing arbitrary Unicode is just an update to the technology of the time of writing. However, Logiweb enhances identifier naming in one, important way: it allows to use space characters almost like any other character inside constructs. Allowing that is not completely new since the original version of Lisp also allowed that.

The space character is not completely like any other character, however: In Logiweb, constructs are not allowed to start or end with space characters. Furthermore, several space characters in a row count as a single space during parsing, both in the source and in construct definitions. Actually, arbitrary sequences of space, tab, newline, and similar characters count as a single space.

The ability to put parameters anywhere in function names as in (( m , n )) has no analog in C. In Common Lisp, insisting programmers can do something similar using readtables.

The 'extend' interface

Whenever an author of a Logiweb page needs to do something the Logiweb programming language cannot do like doing system calls or doing I/O, the author needs to write a handler function and run it in a Logiweb machine.

Whenever an author needs to do something which not even the Logiweb machine can do, the author must resort to using C.

When a Logiweb machine starts up it can do the following:

Whenever the handler produces an extend event, a new collection of events become available in addition to those already available. Which and how many events become available depends on the string sent through the C compiler.

In other words, Logiweb uses C as backstop: Whatever Logiweb cannot do itself has to be delegated to C.

Prev Up Next Page 22 of 800 Search logiweb.eu

Copyright © 2010 Klaus Grue, GRD-2010-01-05