At 12:03 Uhr -0800 04.01.2006, Alex Goldman wrote:
Hi
I've looked at the documentation, and I have some questions:
What does Gambit do to reduce name clutter in bigger than toy programs? (...) Are there reader modifications that mimic Common Lisp's packages?
It offers the undocumented ##namespace form. See examples/* in the source archive. I've written "chjmodule" which makes dealing with those easier, see my previous announcements on this mailing list.
##namespace is not a reader macro, but a compiler/interpreter directive. It can also be put into a local scope. Like:
(##namespace ("foo#")) (define (display v) (##namespace ("" display newline)) (display "v: ") (display v) (newline)) (##namespace ("" fun +)) (define (fun a b) (display (+ a b)))
; > (compile-file "foo.scm") ; #t ; > (load "foo") ; "/home/chris/schemedevelopment/gambit/mod/foo.o2" ; > (fun 1 2) ; v: 3
Incidentally, I tried to use the reference implementation of SRFI-82, but it failed with beta 15.
Do you mean srfi-83? What about André v. Tonder's implementation?
If you do use gambit-generated code in your C program, can you also use pthreads?
From what I gather there is an example in the gambit source archive (examples/pthread/).
Gambit allows file-level declarations. Is it possible to declare a specific variable to be fixnum or flonum, for example, or would that be useless anyway?
You can also declare fixnum or flonum in a lexical context. But I think not on single variables. From what I can tell, it's about how the generic operations like + - expt etc. are specialized, not about the variables. You can always use unsafe lowlevel operations on particular variables:
(define (foo a b) ; a: fixnum, b: flonum (if (and (##fixnum? a) (##flonum? b)) (##flonum.+ (##flonum.<-fixnum a) b) (error "invalid operands")))
Is it possible to UNload a shared library?
((Assuming that you are talking about compiled gambit object files:) Probably not since it would require support from the gc ("when is it safe to unload code?"). Of course I'm not authoritative. I've been wondering about this too, for long running processes, but then: it shouldn't be a problem anyway, since the files are memory-mapped (on linux anyway) and thus will barely take any real memory once they are not used anymore. And how long would it take to fill up a 32 bit virtual address space with object files? Like if you're loading 100 shared objects of 200kb each per day, it will take about 100 days.)
Christian.