LPARAMETERS m.tcVar >IF VARTYPE(m.tcVar) # "C" > RETURN .F. >ENDIF >LOCAL m.lcSafety >m.lcSafety = SET("SAFETY") >SET SAFETY OFF >* ... some processing >IF somebusinesscondition = .F. > SET SAFETY &lcSafety. && You have to remember to reset it here. > RETURN .F. >ENDIF >DO SOMETHING >SET SAFETY &lcSafety. >RETURNWhile I agree that the cSet class (which exists as a freebie in the CodeBook, and is inherited in at least one CodeBook-derived framework that I used) makes things simple, your example of an early exit is slightly wrong - the exit is not early enough. If you're exiting early, you should do so before you change any SETtings:
LPARAMETERS m.tcVar IF VARTYPE(m.tcVar) # "C" RETURN .F. ENDIF IF not somebusinesscondition RETURN .F. ENDIF * now we're doing business, save settings and do it LOCAL m.lcSafety m.lcSafety = SET("SAFETY") SET SAFETY OFF * ... some processing DO SOMETHING * ...done, restore. SET SAFETY &lcSafety. RETURNOf course, there may be other exits that may be required during the business part, but these may be bracketed using a simple status variable:
lOK=SomeCheck() if lOK * do some more lOK={new check condition} endif if lOK * keep on processing lOK={another check condition} endif * done, restoreThis way you don't have to have other exits but the early exits (before you disturb the settings) and one final exit (where you restore the settings).