Subject: Re: PLOT: A non-parenthesized, infix Lisp!
From: rpw3@rpw3.org (Rob Warnock)
Date: Tue, 21 Apr 2009 23:44:48 -0500
Newsgroups: comp.lang.lisp,comp.lang.misc,comp.lang.scheme
Message-ID: <SdCdnW9jkuhdPXPUnZ2dnUVZ_hednZ2d@speakeasy.net>
Kenneth Tilton  <kentilton@gmail.com> wrote:
+---------------
| Andrew Reilly wrote:
| > Christopher wrote:
| >> budden <budden-l...@mail.ru> wrote:
| >>> C is not, strictly speaking, a statically typed language.
| >> Yes it is. All types are known statically at compile time. You can build
| >> dynamic schemes in C, but the language itself is nevertheless still
| >> statically typed.
| > 
| > void *
| 
| Ah, the value infinity in typese.
+---------------

But essentially useless for implementing a dynamic layer on C,
since you can't do any arithmetic at all on "void *" objects.

On the other hand, you *can* do simple pointer arithmetic on the
type "void **", so the latter is perhaps a better choice for a
Lisp object, e.g., "typedef void ** lispobj". I actually did this
once for a hacked-up version of Elk Scheme[1]. Worked fine.

On the third hand, even "void **" has a few odd corner restrictions,
so most Lisps (e.g., CMUCL) end up with "typedef long lispobj" or
similar, and use lots of C macros to pun the integer lispobjs into
pointers instead of lots of macros to pun the pointer lispobjs into
integers.


-Rob

[1] In order to make the "Object" type smaller.
    It was two words originally:

      typedef struct {
	  unsigned long data;
	  int tag;
      } Object;

    Replacing that with "typedef void **Object;" (and tweaking the
    various access macros to use lowtags) made the code run faster,
    at least on x86 CPUs.

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607