This is the mail archive of the guile@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]

Re: Performance, argh


Lalo Martins <lalo@webcom.com> writes:

> IMVHO, Perl and Python have small startup times due to
> "semicompiled" (or byte-compiled or whatever each language calls
> them) modules. 

--- yet another "my module system is great" advertisement :)) --- 

Yes -- and no.  When I start guile -c "(display (+ 1 2))" 
it beats perl -e "print 1 + 2;"!

Perl has only one module system and this module system is written in
C.  Guile doesn't have a module system at all.  Instead it has name
spaces (environments) which support encapsulation (written in C).  The
beauty is that you can load any module system you want or you can
choose to not use any module system at all and do everything yourself:

(define module-registry (make-finite-environment))
(define module-A (make-eval-environment (make-finite-environment) #f))
(environment-define module-registry 'module-A module-A)
(define module-B (make-eval-environment (make-finite-environment) #f))
(environment-define module-registry 'module-B module-B)

;now start a repl in module-A:
(top-repl (environment-ref module-registry 'module-A))
(define a 100)
(top-repl (environment-ref module-registry 'module-B))
a -> undefined error

The code in (ice-9 modules) exports some handy macros and functions 
to save you from typing too much. :>
It exports `define-module' `export' `open' `define-public' and
other things.  But you don't have to load it. :))


> Perhaps coming up with a ".gscmc" format is all

Excuse me but what is a ".gscmc" format?

Jost

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