obb

donavan 2023-07-17T20:17:40.826319Z

Hi šŸ™‚ I’ve been mucking about with obb a bit and hit something odd, it seems prn goes to std error (my unix-fu is not very strong so I might not be doing the redirection correctly):

āÆ obb -e '(prn "goes to error")' > out 2> error

āÆ cat error
"goes to error"

āÆ cat out
nil

āÆ obb --version
obb v0.0.3

zane 2023-07-17T20:18:08.722679Z

Ah, I faintly remember this.

zane 2023-07-17T20:18:17.218419Z

I think the thing to do would be to check if JavaScript has the same behavior.

donavan 2023-07-17T20:18:20.187279Z

quick off the mark!

donavan 2023-07-17T20:18:27.033059Z

will do…

zane 2023-07-17T20:18:35.619239Z

Might be a weird quirk of OSA.

zane 2023-07-17T20:18:50.647269Z

Hope you’re having fun with obb!

donavan 2023-07-17T20:20:15.166079Z

You’re right, JS does indeed end up in std errro… šŸ™€

zane 2023-07-17T20:20:29.601989Z

Fun!

donavan 2023-07-17T20:25:37.616579Z

yeah, that is certainly a… strange design decision

zane 2023-07-17T20:26:16.145209Z

OSA is this weird, mostly forgotten corner of macOS.

zane 2023-07-17T20:26:47.624159Z

Can I ask what you’re thinking of using obb for?

donavan 2023-07-17T20:31:54.998949Z

Sure, it’s a bit roundabout: I’m using it to really explore available options in plain JXA. Once I’ve got it down with obb I’m translating to JXA as it executes faster than the whole of Clojurescript + obb. In terms of why… I’m mucking about with turning Emacs into a Spotlight/Alfred/Raycast like tool, for e.g., I can hit a key in Safari which copies the title and URL and opens up a floating Emacs frame with Org capture for taking notes

zane 2023-07-17T20:32:45.453339Z

Whoa!

zane 2023-07-17T20:32:50.994289Z

That sounds rad.

donavan 2023-07-17T20:32:59.650719Z

I’m between jobs šŸ˜„

zane 2023-07-17T20:33:07.050329Z

Funemployed!

šŸ˜‚ 1
donavan 2023-07-17T20:34:57.357629Z

I’ve got all the bits and pieces working and a few example commands… now I’m trying to nail down the best way to script MacOS… you’re right, Apple really have seemed to abandoned MacOS scripting… Interestingly you can script in Swift with just a shebang but it’s not as user friendly as JXA or AppleScript

borkdude 2023-07-17T20:40:36.972039Z

> I’m translating to JXA as it executes faster than the whole of Clojurescript + obb. Do you mean in terms of startup time of performance?

donavan 2023-07-17T20:41:23.619129Z

yeah, obb is about 200ms for something simple my side (I can get the numbers I’m just pulling off the top of my head)

borkdude 2023-07-17T20:41:35.914069Z

you still didn't say which

donavan 2023-07-17T20:42:10.402839Z

oh right, did you mean ā€œstartup time or performanceā€?

borkdude 2023-07-17T20:42:17.134019Z

yes

donavan 2023-07-17T20:42:20.148299Z

startup

borkdude 2023-07-17T20:42:28.011119Z

got it

donavan 2023-07-17T20:42:36.763109Z

I’m guessing it has to compile the whole of CLJS per execution?

borkdude 2023-07-17T20:43:06.409189Z

well, obb uses SCI and SCI yields about 1mb of JS. The OSAscript thing isn't the most optimized one I guess. With nbb (Node.js) I have about 100ms of startup time

donavan 2023-07-17T20:43:47.159229Z

yeah, sorry meant SCI + clojure.core

borkdude 2023-07-17T20:43:56.098859Z

I wonder if #cherry or #squint would work for OSAScript. They are compiled and smaller (squint yields the smallest)

donavan 2023-07-17T20:44:25.280919Z

good call

borkdude 2023-07-17T20:45:20.296819Z

I don't know if osascript supports es6 though

donavan 2023-07-17T20:45:59.712939Z

mmm, I’ll probably just go back to JXA for these little bridge scripts

borkdude 2023-07-17T20:46:05.143829Z

yeah

donavan 2023-07-17T20:46:12.084999Z

I even prefer Emacs Lisp to JS though!

donavan 2023-07-17T20:46:56.720199Z

BTW during benchmarking simple scripts nothing I can find beats bb šŸ˜‰

šŸ’Ŗ 1
donavan 2023-07-17T20:47:18.676949Z

not even compiled (second+ run) Swift scripts