sci

doojin 2026-04-04T09:26:26.146509Z

@borkdude I want your feedback on my idea. Do you also think it is a good idea to use a babashka/node.js process as a sandboxing boundary for untrusted SCI scripts? Both babashka and node.js consume less RAM than JVM clojure. Both can enforce memory limit. Both can be killed safely after a timeout.

borkdude 2026-04-04T09:27:29.628639Z

yeah makes sense. babashka + SCI is used like this e.g. on clojure IRC in a bot that can execute arbitrary code examples and is killed on timeout

🙌 1
doojin 2026-04-04T11:21:46.026269Z

I think limiting execution time/step and memory consumption of a turing-complete language like SCI is a hard problem. If you want a limited scripting language, you better design it from scratch.

borkdude 2026-04-04T11:22:42.554519Z

yes, SCI does explicitly not support that, so if you want to limit turing completeness, find something else or write your own

doojin 2026-04-04T11:23:18.361999Z

I think turing-complete languages are known for non-deterministic termination. A turing-complete language can't deterministically terminate itself.

borkdude 2026-04-04T11:24:05.471679Z

you are stating obvious facts about turing completeness. is there a question in there or?

doojin 2026-04-04T11:24:32.476519Z

I mean people forget this fact when they try to limit execution steps of SCI. It's probably an unsolvable problem.

doojin 2026-04-04T11:25:48.002159Z

So, I think running untrusted SCI scripts in a proper sandboxing environment like babashka/node.js processes is the right solution. You just need to find a sandboxing environment that doesn't consume a lot of RAM.

borkdude 2026-04-04T11:25:53.573999Z

yep

john 2026-04-04T12:08:46.840629Z

What I'd really love to have a "metered sci" "You get 10 thousand cycles"

borkdude 2026-04-04T12:09:53.956139Z

sure, that's been suggested before and I also tried it but it has performance consequences and it'll never be perfect since clojure.core functions aren't interpreted and you can still use unlimited resources with those

john 2026-04-04T12:13:21.799769Z

hmmm I would think that as long as the turing completeness provided is only by sci's compbination of clojure.core fns, and each of them would by themselves run in some bounded deterministic time, then the overall turing complete action would be time bounded. But yeah I guess you can't accurately measure the underlying cycles

borkdude 2026-04-04T12:13:45.841379Z

(doall (range))

john 2026-04-04T12:14:09.868469Z

Hmmm... Yeah, you'd have to detect all those.

borkdude 2026-04-04T12:14:28.847359Z

you need to control the VM or the host

borkdude 2026-04-04T12:14:32.782469Z

ask the JVM folks ;)

borkdude 2026-04-04T12:14:38.431979Z

or Node.js or whatever

john 2026-04-04T12:14:47.710809Z

wasm maybe

borkdude 2026-04-04T12:14:55.704469Z

wasm isn't a host

john 2026-04-04T12:15:17.213219Z

But I don't think I need fine grained cycle knowlege. Just bounded cycles

john 2026-04-04T12:15:34.248169Z

the infinite seqs are a problem though

borkdude 2026-04-04T12:16:09.207849Z

even with finite stuff, you can construct stuff that takes longer that you'd wish for

john 2026-04-04T12:16:19.181129Z

I'm wanting it for a distrubed computation utility token scenario, where you need to just measure work evenly across peers

john 2026-04-04T12:16:53.871399Z

As long as the cost profile is fair between peers

john 2026-04-04T12:19:05.711719Z

As long as it is deterministic and gives the same invoice for services rendered on both peers

doojin 2026-04-04T13:37:53.257169Z

John, time is the most fundamental currency in the universe. Meter time. Time and attention are the two most fundamental currencies in the universe. Money is an imaginary medium of exchange, but time and attention are real. Even your utility tokens are an imaginary medium of exchange. Money is not real. Your tokens are not real. Time is real. • Enforce a timeout from outside, and charge per an execution that has a hard timeout • Charge per second of execution, and don't enforce a hard timeout. You can charge each second differently for different CPU cores. Run one SCI script at a time in one process. Then, each SCI job gets one dedicated CPU core.

doojin 2026-04-04T13:46:46.292789Z

Cloud platforms sell shared/dedicated CPU cores per month. You should do the same perhaps.

doojin 2026-04-04T13:47:27.495929Z

Perhaps, sell dedicated/shared CPU cores per month, week, day, second, whatever.

doojin 2026-04-04T13:49:30.141449Z

Sell time. Become a time lord.

john 2026-04-04T13:51:04.049269Z

lol