This is the mail archive of the guile@cygnus.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: hobbit.scm call-order.patch


I wrote:
>I ran into a problem using a hobbit-compiled hobbit that I tracked
>down to what I think is argument evaluation order problems in the
>C version of hobbit.  Global variable *new-funs-list* gets built
>in the wrong order.
                   ^-- , or improperly.

Sorry to follow up my own message ...
I don't have time to research things further, but I'd like to confirm
my understanding of things.  What does Scheme have to say about argument
order evaluation?

Consider this:

(define global '())

(define (foo a b)
  (set! global (cons 42 global))
  (list global a b)
)

(define (update-global)
  (set! global (cons (foo 1 2) global))
  global
)

and it's hobbitized version

SCM foo(a,b)
SCM a,b;
{
  GLOBAL(global)=cons(MAKINUM(42),GLOBAL(global));
  return cons(GLOBAL(global),cons(a,cons(b,EOL)));
}

SCM update_global()
{
  GLOBAL(global)=cons(foo(MAKINUM(1),MAKINUM(2)),GLOBAL(global));
  return GLOBAL(global);
}

Does Scheme have anything to say about argument evaluation that conflicts
with what C says?