scittle

2023-04-15T20:17:59.531369Z

greetings friends! i'm working on contributing a hoplon plugin (assuming interest, nbd if not) and i've hit a little puzzler in sci.configs test. looks like there aren't js/window or js/Elementwhich hoplon core.cljs needs to do stuff (like extending a protocol to Element). looks like Node is the environment there. should i investigate adding a shim? or something else? thanks in advance for guidance 🙏

borkdude 2023-04-15T20:24:18.421779Z

@alandipert hey! js/window should work, but you have to enable global access in SCI with:

{:classes {:allow :all 'js js/globalThis}}

borkdude 2023-04-15T20:25:34.137769Z

This is enabled in scittle, but maybe not in sci configs tests? Is that what you run into?

2023-04-15T20:33:31.414269Z

possibly, yes it's the sci configs test that has the issue

2023-04-15T20:34:19.530149Z

ah, i see, that goes in the same map where :namespaces

borkdude 2023-04-15T20:34:29.816759Z

indeed

2023-04-15T20:41:19.220509Z

so, i graduated to ReferenceError: Element is not defined

borkdude 2023-04-15T20:42:37.975969Z

Maybe this is because you're running in Node.js instead of a browser?

borkdude 2023-04-15T20:44:33.920049Z

Upgrading SCI might help here btw, if it's supposed to work in Node

borkdude 2023-04-15T20:45:49.933899Z

I bumped SCI on the main branch

2023-04-15T20:46:03.816959Z

almost certainly because Node, hence my thinking about a shim.. hoplon definitely currently requires a browser environment because it extends a protocol to a browser thing (Element)

2023-04-15T20:46:15.846439Z

but do i understand right that this is a hurdle for the test but not necessarily hoplon ultimately working in scittle?

2023-04-15T20:46:39.362139Z

fwiw i'm blindly copypasting from stuff i see for reagent/reframe 🙈

borkdude 2023-04-15T20:47:00.308039Z

sci.configs is currently tested with Node.js, but maybe we should include a browser test as well... shim would be ok with me

👍 1
borkdude 2023-04-15T20:47:16.617799Z

scittle works in the browser

borkdude 2023-04-15T20:47:40.777299Z

if your goal to provide a hoplon playground?

2023-04-15T20:48:06.623309Z

if i can get this working i'll probably just use hoplon this way for all my stuff

borkdude 2023-04-15T20:48:14.444179Z

:)

2023-04-15T20:49:00.976279Z

happier than most to avoid build tooling when possible

➕ 3
2023-04-15T20:49:31.234749Z

thanks very much for your assistance, i'll see about a shim and follow up eventually with a PR

👍 1
borkdude 2023-04-15T20:50:24.128589Z

btw I'm also working on a follow up to SCI which is more like a compiler than an interpreter: https://github.com/squint-cljs/cherry/blob/main/doc/embed.md so maybe eventually I'll port scittle over to that as well (while not deprecating scittle) for better performance, although performance with SCI ain't that bad for typical web-app stuff (see e.g. this pinball game made with scittle: https://thegeez.net/static/pinball/pinball.html)

borkdude 2023-04-15T20:51:43.771759Z

@alandipert if it helps you can also include a Node.js shim library in package.json

2023-04-15T20:53:23.928829Z

Thanks, that's the direction I had in mind also

2023-04-15T20:53:40.399209Z

This is all very cool and exciting btw, really appreciate your efforts!

🙏 1