bug-mit-scheme
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-mit-scheme] Compiler doesn't like SLIB let-values (SRFI 11)


From: Matt Birkholz
Subject: [Bug-mit-scheme] Compiler doesn't like SLIB let-values (SRFI 11)
Date: Thu, 26 Apr 2012 09:27:56 -0700

> From: John Carr <address@hidden>
> Date: Mon, 23 Apr 2012 16:19:03 -0400
> 
> 
> I'm not sure if this is a bug (and if so, whose) or an expected
> incompatibility betwen SLIB and MIT-Scheme.

It is an expected limitation of "separate compilation", i.e. the
two-step process of compiling a file in one world and then loading it
in a different one.

> If I compile a function that uses let-values (SRFI 11) the function
> errors at runtime.

Compiling an expression like (require 'srfi-11) does not evaluate it.
You need to evaluate it BEFORE you compile your file, else the
compiler will assume let-values is a procedure to be applied to five
arguments.

> If I load the .scm file it runs fine.

To make scripts easier to write, a .scm file is "loaded" by evaluating
each top-level expression immediately.

Compiling a .scm file is something completely different, giving the
compiler license to re-order top-level expressions, assume names that
are not macros will NEVER be macros, etc.

In short: don't compile your scripts.  Loading a compiled script
rarely does what you want.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]