box:=NewByrdBox(predicate)// ...control:=make(chanstruct{})// Could be a channel of useful information insteadexit,except:=box.Call(bindings,control)// e.g. maybe interacting with a user...select{casesoln,ok<-exit:{if!ok{// Failed...}// Use the solution...// ...control<-struct{}{}// e.g. ready for the next solution}caseintermediate,ok<-except:{if!ok{// Stopped... maybe control was closed}// Use the intermediate value// e.g. maybe trace/debug info, e.g. a sub-goal byrd box was created so draw it// e.g. maybe the value is an exception or a breakpoint so display it and prompt for an actioncontrol<-struct{}{}// e.g. maybe user continued the debugger. could be a "step" or a "continue" message instead of an empty struct}}// ...close(control)// e.g. maybe the user's tired of all this debugging and needs a coffee
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.