[plt-scheme] order of instantiation

From: Mike T. Machenry (dskippy at ccs.neu.edu)
Date: Tue Sep 17 15:46:48 EDT 2002

I am attempting to write a function that adds panel to a frame. This panel
must contain a message% and a button%. The button% callback must refer to
the message%. When I wrote the function initilally I had:

(deine (func frame)
  (let ([panel (instantiate ... (parent frame) ...)]
        [message (instantiate ... (parent panel) ...)])
    (instantiate button% ...)))

I then realize that it is much better to have the button be to the left
of the message. This seems to be alot more difficult as I need to instantiate
the button first inorder to do this. However when I do this I cannot reference
the (then undefined) message%. I wrote a version using letrec but it is not
working as the callback (defined after the button in the letrec) is 
undefined. Anyone know how I can get around this?


Posted on the users mailing list.