From: Christopher Allan Webber Date: Wed, 14 Dec 2016 21:15:56 +0000 (-0600) Subject: Document why the clerk-act-update-loop calls itself X-Git-Tag: fosdem-2017~128 X-Git-Url: https://jxself.org/git/?p=mudsync.git;a=commitdiff_plain;h=e585ab65215e84cb5fa12fd84ffeee0421e56d07 Document why the clerk-act-update-loop calls itself --- diff --git a/worlds/bricabrac.scm b/worlds/bricabrac.scm index d458327..84836fa 100644 --- a/worlds/bricabrac.scm +++ b/worlds/bricabrac.scm @@ -674,6 +674,7 @@ attend to.\n") (define clerk-return-to-slacking-text "The desk clerk enters and slams the door behind her.\n") + (define (clerk-act-update-loop clerk message) (define (tell-room text) (<- clerk (gameobj-loc clerk) 'tell-room @@ -681,6 +682,14 @@ attend to.\n") #:exclude (actor-id clerk))) (define (loop-if-not-destructed) (if (not (slot-ref clerk 'destructed)) + ;; This iterates by "recursing" on itself by calling itself + ;; (as the message handler) again. It used to be that we had to do + ;; this, because there was a bug where a loop which yielded like this + ;; would keep growing the stack due to some parameter goofiness. + ;; That's no longer true, but there's an added advantage to this + ;; route: it's much more live hackable. If we change the definition + ;; of this method, the character will act differently on the next + ;; "tick" of the loop. (<- clerk (actor-id clerk) 'update-loop))) (match (slot-ref clerk 'state) ('slacking