This is the mail archive of the guile@sources.redhat.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: guile-vm-0.2


Mikael Djurfeldt <mdj@mdj.nada.kth.se> writes:

> > How do you support it?  Could you expand a set! form to a corresponding
> > setter form at this time?  Or do you leave it as it is?
> 
> I have now done the former.

Great!  It seems working well.  I tried to test it with my VM but failed:

  % cat foo.scm
  (define foo (make-procedure-with-setter (lambda () #t) (lambda (v) v)))
  (display (foo))
  (display (set! (foo) #f))

  % guile-compile foo.scm 
  % guile -s foo.scc
  ERROR: In procedure make-procedure-with-setter:
  ERROR: Wrong type argument in position 1: #<program 0x8098dc4>

Guile doesn't understand my VM...  One way to solve this problem is
to modify Guile so that it cooperates with my VM.  Another way is to
rewrite the procedure in Scheme and byte-compile it:

  % cat foo2.scm
  (define (make-procedure-with-setter getter setter)
    (set-object-property! getter 'setter setter)
    getter)

  (define (setter getter)
    (object-property getter 'setter))

  (define foo (make-procedure-with-setter (lambda () #t) (lambda (v) v)))

  (display (foo))
  (display (set! (foo) #f))

  % guile-compile foo2.scm 
  % guile -s foo2.scc
  #t#f

I'm going to implement some procedures like `map' this way.
(Or `map' will be probably inlined.)

> > Yes.  I hope the next module system includes this fix.
> 
> It could actually be instructive to try it already in the current
> system.  The problem is actually more on the syntax-case side (since
> the code isn't module aware) than on the module system side.

I just started looking at psyntax.ss...

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