Re: [Flashforth-devel] jumping without a return
Brought to you by:
oh2aun
From: Christopher H. <chr...@li...> - 2021-04-22 18:57:51
|
So far the following has not crashed: scheme@(guile-user)> (define (foo) (display "|") (sleep 1) (eval-string "(bar)"))scheme@(guile-user)> (define (bar) (display "-") (sleep 1) (eval-string "(foo)"))scheme@(guile-user)> (foo)|-|-|-|-|-|-|-|-|-|-|- |-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|- |-|-|-|-|-|-|-|-|-|-|-|-|-|... -----Original Message-----From: Mikael Nordman < mik...@fl...>To: Christopher Howard < chr...@li...>Cc: fla...@li...Subject: Re: [Flashforth-devel] jumping without a returnDate: Thu, 22 Apr 2021 21:28:04 +0300 What I meant to ask was if the the cross function tail jump works when using eval("foo") at the tail ? On 2021-04-22 19:35, Christopher Howard wrote: > It works fine so long as the procedure call is at the end of calling > procedure. Scheme standard guarantees tail call optimization. In > other cases you might get a return stack overflow. > > When you define the first of the two procedures, you get a warning > that the other procedure might not be defined. Or at least this is > how it works in Guile scheme: > > scheme@(guile-user)> (define (foo) (display "|") (sleep 1) (bar)) > ;;; <stdin>:13:38: warning: possibly unbound variable `bar' > scheme@(guile-user)> (define (bar) (display "-") (sleep 1) (foo)) > |