freenode/#lisp - IRC Chatlog
Search
22:00:33
stylewarning
whartung: it keeps track of how many times it "retries" so that it doesn't go into an infinite loop of CERROR -> INVOKE-RESTART -> CERROR -> ...
22:01:59
whartung
sure, but, I mean, I haven’t studdied this in detai, but where does it do anything to try and mitigate the missing dependancy when it discovered the issue?
22:02:56
stylewarning
whartung: it calls (transform xform-to-do instance), which satisfies one of the required dependencies, decreases the no. of allowed attempts to recover, and loops back to check if all deps. are satisfied
22:05:18
stylewarning
whartung: here is another example of a custom-defined restart called TRY-NEXT-COMPILER. If a compilation function fails, it gives either the user (interactively) or the caller (non-interactively) an option to keep on trucking with compilation. https://github.com/rigetti/quilc/blob/master/src/compilation-methods.lisp#L71
22:05:36
whartung
coudn’t this have been readily done without a restart? just not sure how this case highlights the use of a restartable condition vs not.
22:11:21
p_l
whartung: the crucial difference is that the stack is not unwound, so you don't have to do crazy things to checkpoint and restore state
22:21:12
stylewarning
whartung: The latter one is certainly used interactively, I forget if there are non-interactive invocations
22:21:48
stylewarning
whartung: most of these can be avoided if you can sufficiently pass data about decision-making up and down the call stack
22:24:05
sjl
I use them in my option parsing library. If the library parses command line options and sees an unknown option, it signals a condition and lets you choose between a number of different restarts if you're working interactively: https://github.com/sjl/adopt/blob/master/src/main.lisp#L362
22:24:31
sjl
But if you're writing a program that uses my option parser and want to just ignore unrecognized options, you can choose to invoke the restart programtically https://github.com/sjl/adopt/blob/master/src/main.lisp#L302
22:24:58
sjl
or choose the "treat as normal argument" restart programtically instead https://github.com/sjl/adopt/blob/master/src/main.lisp#L314
2:09:09
PuercoPope
Xach: Don't know if you are aware but https://www.xach.com/clhs has been returning 502 for the last few days. Its my goto search method when outside of Emacs.
4:00:13
fiddlerwoaroof
whartung: before I learned CL, I implemented restarts myself in Python to facilitate a major data migration from a schemaless database to one with a strictly enforced schema
4:00:48
fiddlerwoaroof
It saved me numerous cases of "wait half an hour for a crash to happen, change the code and wait half an hour to see if the fix worked"
4:01:56
fiddlerwoaroof
Although this was a semi-interactive situation: when there was an exception, I'd inspect the data, add a rule to handle it to a collection of rules and then restart the migration process which could now handle the new category of malformed data automatically.