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

Marc Feeley feeley at iro.umontreal.ca
Wed Jun 19 13:45:36 EDT 2013


The "absent" object is one of those values that the application programmer should never use.  There is no explicit way to get at this object unless you use Scheme extensions.  Of course, now that you know about (##encoding->object n), there's a way to generate the "absent" object explicitly.  This breaks an invariant, so don't do it!  It is for internal use by the runtime.

Marc

On Jun 19, 2013, at 6:40 AM, Mikael <mikael.rcv at gmail.com> wrote:

> 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.
> 
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list




More information about the Gambit-list mailing list