Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

23
LINES

< > BotCompany Repo | #1033007 // ExecFreshRealEval

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (13942L/87K).

sclass ExecFreshRealEval {
  S code;
  double timeout = 60.0;
  IF1<S> safetyCheck;
  IF0<AutoCloseable> enter = dm_tempEnter();
  bool showStackTraces;
  
  swappable void postMessage(S output) { print(output); }

  run {
    temp callF(enter);
    dm_refreshTranspiler();
    IF0 f = -> {
      temp callF(enter);
      try answer safetyCheck?.get(code);
      ret print("eval result > ", str(dm_javaEval(code));
    };
    S output = showStackTraces
      ? evalWithTimeout_text_showStackTrace(timeout, f)
      : evalWithTimeout_text(timeout, f);
    postMessage(output);
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033007
Snippet name: ExecFreshRealEval
Eternal ID of this version: #1033007/10
Text MD5: e0eb5947929cce1a8a24aba32045352a
Transpilation MD5: 87383763304e6096237edb9ba9f96ac9
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-11 12:58:45
Source code size: 603 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 173 / 329
Version history: 9 change(s)
Referenced in: [show references]