unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
To: guile-devel <guile-devel@gnu.org>
Subject: Common Lisp ontop of guile
Date: Mon, 19 May 2014 22:36:34 +0200	[thread overview]
Message-ID: <CAGua6m2YJ7K_jBokXbcEXehA-+rUp7RD3+so35oON1fFY22YEw@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2564 bytes --]

Hi, I saw on irc that nalginrut was dreaming of implementing common lisp
ontop of guile
I have spent some time thinking on that and came to the following
conclusions.

1. Common lisp symbolic treatment and guile's syntax system does not mix
well.
2. If we want to reuse CL code we will find out that the it produces tons
of tagbodies.
This can't be directly implemented by letrecs but delimeted continuations
is needed. And with those it is somemwhat fuzzy how well optimized the code
will become e.g. there is a risk of slow tagbodies. On the other hand doing
an implementation of CL might challange the guile hackers to produce an
even better optimizer. So tagbodies is doabale and I have code that does
them.
3. CL is littered with use of put and get together with symbols, these
probably have to be fast in order to be usable for the common lisp code out
there. But for a first try, a simple hashmap will probaly do.
4. CL symbols has a variable context and a function context, again a
hashmap can be used on the symbols namespace combo.
5. The CL spec is pretty hefty but most of it should be able to be derived
from a smaller subset of ideoms. I would try to find an implementation (or
an early correct version of an implementation of CL) where this is a fact
(matured versions tend to optimize ideoms to death and therefore many idems
will be special) Ask around in CL forums for the best fit.
6. Not sure how to make the CL module system to interop with the guile
system

Again if one can find a CL implementation witch is mostly written in CL,
then the effort might not be too hefty.

A question is how one would treat common lisp symbols, if we would like to
interoperate between scheme and CL one need to do it with symbol name
mangling
   e.g. f @ ns => f::ns

With this we may be able to write a reasonable compiler to scheme

Another possibility might be to treat symbols as vectors e.g.
#(cl-symbol symbol ns (fslot) (vslot) (put/get-alist))

It's but ugly, but for sure the guile compiler would make sure that all
symbol vectors point to the same vector hence the fslot vslot and
put/get-alist is unique and can be mutated as is, then of cause there need
to be some code written to be able to lookup these structures in other
modules. Perhaps all symbols in a module can be put as a namespace mangled
symbol guile exported as symbol e.g. g::nm for use in scheme code also a
good thing with this is that ns can be a list of symbols just as in guile.

I'm sure I've mised many points but at least these thoughts might initiate
a discussion.

Cheers!

[-- Attachment #2: Type: text/html, Size: 2930 bytes --]

             reply	other threads:[~2014-05-19 20:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-19 20:36 Stefan Israelsson Tampe [this message]
2014-05-20  2:06 ` Common Lisp ontop of guile Nala Ginrut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGua6m2YJ7K_jBokXbcEXehA-+rUp7RD3+so35oON1fFY22YEw@mail.gmail.com \
    --to=stefan.itampe@gmail.com \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).