[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dynamic binding



    Date: Fri, 29 Jul 83 19:22:50 PDT
    From: PATEL at UCLA-LOCUS.ARPA

    In writing some code I came across a need for dynamic binding. I
    tried "bind", but it doesn't seem to work the way I thought it
    would. Either there is a bug, or my understanding is faulty. I was
    trying to define some functions that would "throw" if there was an
    error, but I did not want to define them within the corresponding
    "catch". So, I thought of defining them outside the catch, and then
    dynamically binding the name of the escape procedure. However, as
    you can see from the transcript, it seems that it didn't quite work.
    Either "catch" did not bind "blech" correctly before evaluating the
    "bind" expression, or "bind" did not do its job quite well?

    This is VAX/Unix T version 2.6 (63)
    > (define (foo x) (if (> x 5) (blech 'big) 'small))
    #{Procedure FOO}
    > (catch bleep (bind ((blech bleep)) (foo 7)))
    BIG
    > (catch blech (bind ((blech blech)) (foo 7)))

    ** Error: variable BLECH has no value
    >> (exit)


    Thanks,

    'dorab