!7 concept EvaluationResult { S code; S safety; S comments; S date; } cmodule CodeSafetyAnalysis > DynCRUD { transient ReliableSingleThread rstCalc = dm_rst(me(), r calc); transient SingleComponentPanel scpSuggestions; S code; PairS safety; // tested code + safety result Set unknownIdentifiers; start { dm_useLocalMechListCopies(); dm_watchFieldAndNow code(rstCalc); } visual with(rstCalc, jvsplit( centerAndSouthWithMargins( jhsplit( dm_textAreaAsSection code(), jCenteredSection("Suggestions", scpSuggestions = singleComponentPanel())), centerAndEast(jCenteredSection("Safety", dm_calculatedLabel(() -> pairB(safety))), jbutton("Save result", rThreadEnter saveResult)) ), jCenteredSection("Past Results", super))); void calc { S code = this.code; setField(safety := pair(code, codeSafetyCheckResult(code))); setField(unknownIdentifiers := codeAnalysis_getUnknownIdentifiers(code)); setComponent(scpSuggestions, () -> scrollableStackWithSpacing( map(unknownIdentifiers, id -> jLabelWithButtonsAndSideMargin(id, "Mark safe", rThread { markSafe(id); rstCalc.trigger(); }, "Mark UNsafe", rThread { markUnsafe(id); rstCalc.trigger(); })))); } void saveResult { rstCalc.waitUntilDone(); PairS p = safety; if (p != null) cnew EvaluationResult(code := p.a, safety := p.b, date := formatLocalDateWithSeconds()); } }