The #<absent> behaves differently as argument on call to interpreted vs to compiled procedure, interesting.
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.
Afficher les réponses par date
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@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@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
participants (2)
-
Marc Feeley -
Mikael