[gambit-list] The #<absent> behaves differently as argument on call to interpreted vs to compiled procedure, interesting.

Mikael mikael.rcv at gmail.com
Wed Jun 19 09:40:03 EDT 2013


For anyone interested, on a 64bit installation:

f.scm contains: (define (proc arg) (list 'proc-got-arg: arg))

$ gsc
Gambit v4.6.9

> (compile-file "f.scm") (load "f.o1")
> (proc (##encoding->object #xffffffffffffffea))
(proc-got-arg: #<absent>)

> (define (proc arg) (list 'proc-got-arg: arg))
> (proc (##encoding->object #xffffffffffffffea))
*** ERROR IN (console)@4.1 -- Wrong number of arguments passed to procedure
(proc)
1>


In interpreted mode, any absent object passed as argument disappears.


This has the funny consequence that a procedure overlapping ##wr must be
compiled,

(define original-wr ##wr)

(set! ##wr (lambda (write-env obj) (original-wr write-env obj)))

(##encoding->object #xffffffffffffffea)


this only works if it's compiled.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20130619/13bf0b06/attachment.htm>


More information about the Gambit-list mailing list