[Larceny-users] on porting to larceny

Marco Maggi marco.maggi-ipsu at poste.it
Sat Dec 27 04:26:26 EST 2008


Thanks  for the prompt  replies.  Things  seems to
work.

I thought  that problems would  come from language
incompatibilities (like immutable pairs or library
expansions), that  would have made  porting a long
process; but  I have got  almost none of  those so
far.   Instead  it  seems  that the  problems  are
mostly "logistic".

By the  way, I  pushed recent developments  to the
public   repository[1].   There   are  significant
changes since the last  public revision; it is not
a milestone  (some projects do not  work), but the
R6RS,  SRFI, Uriel,  IrRegex  and ScmObj  projects
pass the test suites with Ypsilon-335, Ikarus-1721
and Larceny-5880.

[1] http://github.com/marcomaggi/nausicaa/tree/master

What follows  is a miscellaneous set  of notes.  I
dunno    what    is   technologically    possible,
economically sustainable and architecturally wise,
so I just put them here as open issues.

*** The built  in PARAMETERIZE  does not act  as a
LETREC-like form:

(parameterize ((parm 123))
  (define a 1)
  1)

raises  a syntax  violation error  because  of the
definition.  So I wrapped it in:

|(define-syntax parameterize-this
|  (syntax-rules ()
|    ((_ ?bindings ?form0 ?form ...)
|     (parameterize ?bindings
|       (letrec* () ?form0 ?form ...)))))

which  seems  to   work.   I  dunno  if  Larceny's
implementation  conforms to  the SRFI  (which says
that the body should  be a non-terminal R5RS body,
whatever  that  means),  but Ypsilon,  Ikarus  and
Guile  allow  definitions   AFAICT.   I  see  that
SRFI-39  in  "lib/SRFI/srfi-39.sch"  just  defines
MAKE-PARAMETER, it does nothing for PARAMETERIZE.

*** If I have not missed it in the source, the FFI
does  not implement peekers  and pokers  for "long
double" and "long long".  They are unusual, but if
the cost of adding them is small...

*** The  FFI  does  not  allow  retrieval  of  the
"errno" value just  after a foreign function call.
Ikarus and Ypsilon allow this by storing the value
in an internal state variable that can be accessed
later with a procedure.

My initial proposal to both the Ikarus and Ypsilon
implementers  was  to   provide  two  versions  of
interface  function   to  foreign  functions:  the
traditional one and  an augmented onte returning 2
values: the return value from the foreign function
and the value of  "errno".  For Larceny this would
mean implementing a FOREIGN-PROCEDURE/WITH-ERRNO.

*** When I go to:

https://trac.ccs.neu.edu/trac/larceny/wiki

the   phrase   "You   can  checkout   the   source
anonymously  by   following  the  instructions  at
SvnHttpCheckout."  does  not  jump into  my  eyes.
IMHO it should.

*** Cough... sorry  for making myself  a nuisance,
but    can    LARCENYLIBPATH    be   renamed    to
LARCENY_LIBPATH?  It would be more readable.

*** I tried to run compiled Larceny programs using
the "binfmt_misc" Linux  kernel module, but it has
not worked  because "larceny -r6rs  -program" does
not  like   compiled  files.   Well,   it  was  an
attempt...   Just  in  case, the  "#!fasl"  string
should be changed something with "larceny" in it.

*** I  cannot use  COMPILE-STALE-LIBRARIES because
when  there are  the following  files in  the same
directory:

compat.ikarus.sls
compat.larceny.sls
compat.ypsilon.sls

Larceny attempts to compile  all of them, not only
the "larceny.sls" one.

*** There is something I  do not grasp about stale
libraries.  I have the  error coming and going out
of my comprehension.

Ikarus  also  has   compiled  libraries,  and  the
commands  I  use to  compile  and install  without
changing  the file timestamps  work with  it.  But
Larceny wants more.

This what I do:

1. remove all the compiled files;

2. run a Larceny program that looks like:

| (import (rnrs)
|   (larceny compiler))
|
| (compile-library "uriel/lang.sls"
|                  "uriel/lang.larceny.slfasl")
|
| (compile-library "uriel/combinators.sls"
|                  "uriel/combinators.larceny.slfasl")
|
| ---

   in which the compilation order is determined by
   file  inspection  and  Larceny complaints;  the
   "LARCENYLIBPATH" variable  has as first element
   the pathname of the top directory of the source
   tree;

3. package both the source and compiled files in a
   Slackware archive  (.tar.gz) with commands that
   preserve the timestamps;

4. install the package with commands that preserve
   the timestamps; the files go in:

   /usr/local/lib/scheme

5. set LARCENYLIBPATH to "/usr/local/lib/scheme".

If I  now run  programs that import  the libraries
sometimes they work, other times I get the "Client
was  expanded against  a different  build  of this
library."     Somtimes    repeating   the    whole
installation  process solves  it;  other times  it
does not.

For example (for the  brave souls that want to try
my code), right now  I cannot get the MP's project
test suite  to work, but  I think I  have compiled
the  libraries in  the correct  order.   Even when
running the Larceny REPL, doing:

> (import (rnrs))
> (import (uriel foreign))

raises the  error about "(uriel  cstring)", but in
Uriel's compilation script I have:

| (compile-library "uriel/cstring.sls"
|                  "uriel/cstring.larceny.slfasl")
| (compile-library "uriel/foreign.sls"
|                  "uriel/foreign.larceny.slfasl")

so cstring is compiled first.  I dunno what to do.

*** I  have added  a Larceny  shell script  to the
collection of GNU  Readline wrappers using Rlwrap.
I have  gathered a  set of completions  files.  Is
there an  automagic way to get a  list of non-R6RS
Larceny bindings that may be useful in R6RS mode?

-- 
Marco Maggi

"Now feel the funk blast!"
Rage Against the Machine - "Calm like a bomb"




More information about the Larceny-users mailing list