22 lines · 703 B · Text
RawDownload
// name: eval.ck// desc: use Machine.eval to run-time compile and run string as code//       this enables chuck to generate more code to run!//       powerful! perilous!//// version: need chuck-1.5.0.0 or higher//// uncomment this to print out info about Machine:// Machine.help();//// date: Spring 2023 // our code to run"cherr <= 1+1 <= IO.newline();" => string codeStr; // compile the string as code and spork it as a new shredif( !Machine.eval( codeStr ) ) <<< "error evaluating code!", "" >>>; // NOTE: since Machine.eval() sporks the code as a child shred, we// need to give it a chance to run; (a parent shred upon ending will// also end all of its child shreds)1::samp => now;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t