guitarguy1685 Posted April 21, 2017 Share Posted April 21, 2017 I've been using this error handler in lisps where I modify system variables for a while now. I can't remember where I found this code below. (setq *error* (lambda (msg) (setvar "CMDECHO" CRcecho) (setvar "CLAYER" CRlayr) (setvar "ATTREQ" CRattreq) (princ msg) (princ))) What's going here? I've read LEE Mac's tutorial where it's used as a function. Lee Mac seems to use a pretty different method for error hadling. How is setq being used to reset all the sysvar? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 21, 2017 Share Posted April 21, 2017 (setq *error* (lambda ( ... ) ... ) is merely an alternative to (defun *error* ( ... ) ... ) and just another way of assigning a function accepting a single argument to the *error* symbol. Quote Link to comment Share on other sites More sharing options...
Grrr Posted April 21, 2017 Share Posted April 21, 2017 As far I understand the *error* (handler) function works as a callback function, when the code crashes/errors out and accepts only one argument - the error message ( msg symbol in that example ). It took me quite a while to understand the callback functions (most oftenly used in Reactors and DCL (action_tile)). So overall it looks like a pseudo-reactor... with a :vlr-LispWillError event. Quote Link to comment Share on other sites More sharing options...
guitarguy1685 Posted April 21, 2017 Author Share Posted April 21, 2017 As far I understand the *error* (handler) function works as a callback function, when the code crashes/errors outand accepts only one argument - the error message ( msg symbol in that example ). It took me quite a while to understand the callback functions (most oftenly used in Reactors and DCL (action_tile)). So overall it looks like a pseudo-reactor... with a :vlr-LispWillError event. I suppose I don't really understand callback functions. I'll read it up on it over the weekend. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.