This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Loadable scheme object code


Hello folks,

I am considering writing a loadable scheme object mechanism for Guile.
Suppose there is a scheme program like the following:

---- foo.scm ---------------------------
(define-module (foo))

(define (foo x y)
  (if (> x y)
      12345678901234567890
      "Hello, World!"))
----------------------------------------

We can translate this program into some object code notated like this:

---- foo.sco ---------------------------
Header  foo.scm 9
Symbol  define-module foo define x y if >
Number  12345678901234567890
String  13 Hello, World!
Eval    . #1 . . #2 () ()
Eval    . #3 . . #2 . #4 . #5 () . . #6 . . #7 . #4 . #5 () . #8 . #9 () ()
----------------------------------------

Here "Eval" fields are bytecode, where `#1' => `define-module',
`#9' => "Hello, World!", and `.' means "Create a cons of the
following two objects", so this is a mere byte translation from
the original source code.

Since this is not a byte-compiled code in the sense of Lisp,
this method does not affect the execution time; however, we can
load the object code in less time without changing the meaning.
We can also optimize the object code or include a byte-compiled
code if we want.

Do people think this is a good idea?  Or is there any problem?

--
Keisuke Nishida

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]