yamlscript

Ingy döt Net 2024-05-06T20:33:37.781379Z

@zikajk Starting a new thread regarding using the Clojure clj-yamlscript library from bb. I tried it and fails with

8:   (:import (org.yamlscript.yamlscript YAMLScript)))
      ^--- Unable to resolve classname: org.yamlscript.yamlscript.YAMLScript
I'm not 💯 about this because I haven't deep dived into bb yet (planning to) but I think bb cannot access external Java libs, even if listed in bb.edn. The way @delon implemented things was to create a Java binding lib that uses JNA to access libyamlscript, and then the Clojure binding lib simply deps on that. I like this because it puts Java and thus Clojure in the same arena as every other language binding (using FFI to access libyamlscript). Even if we made the Clojure binding not use libyamlscript, we still need to import classes from SnakeYAML-Engine, and iirc bb includes SnakeYAML. I'm hoping that we can make a bb Pod for this. I've already tested Pods with ys and they work. Maybe others can shine some light for me on this stuff. ❤️

Ingy döt Net 2024-05-07T12:56:10.175759Z

I'm gonna try making a bb pod for the YS clojure library today. I had a dream last night that it would be easy 🙂

Akiz 2024-05-07T15:55:47.559969Z

Hi. I wrote something in BB in the style of terraform, so I'm parsing yaml. I was thinking to allow people to write scripts in yaml and then run it through yamlscript. Since BB and yamlscript are similar in many ways, I don't know if it makes sense to devote so much energy to supporting BB. It's just a curiosity to see how such a concept would work. But in any case - thank you for your effort. I would be much more happy if I could crack it but …, no extra time for fun stuff in these days.

Ingy döt Net 2024-05-07T15:57:56.487789Z

@zikajk is the BB in the style of terraform something you can share? Either publicly or directly with me?

Ingy döt Net 2024-05-07T16:01:38.041529Z

I'm working on lots of things and in general most times I try new things I make discoveries that are wins for YS. So don't worry about my time 🙂

😊 1
Akiz 2024-05-07T16:01:38.204039Z

Unfortunately, no. But I plan to make a .dot file manager, which will be public and could also theoretically use custom scripts. But it is just a dreaming right now.

Ingy döt Net 2024-05-07T16:02:23.652199Z

gotcha. well I'll still give the YS pod for bb a shot 🙂

👏 1
Akiz 2024-05-07T16:10:04.226729Z

I will try to take a look what is missing from it being usable as a library (which would be better as you wouldn’t have to install YS).

Ingy döt Net 2024-05-07T16:59:23.296209Z

Don't think that's possible since it needs https://github.com/yaml/yamlscript/blob/main/core/src/yamlscript/parser.clj#L14-L30 which are not included in bb.

Ingy döt Net 2024-05-07T18:45:28.474999Z

But the pod can auto install libyamlscript (pretty sure) so no extra installs to use ys in bb 🤞

Akiz 2024-05-07T18:54:37.262929Z

@ingy And it looks like simillar attemps have already been deprecated in favor of pods :-) https://github.com/babashka/babashka/issues/397

Ingy döt Net 2024-05-06T20:39:12.397999Z

Here's what I tried more specifically: https://gist.github.com/ingydotnet/319ab624ccc3d8b3c8f3b2a3f91a0270

Ingy döt Net 2024-05-06T20:58:16.165909Z

I published the Java binding lib to Clojars because Maven Central publishing seemed like a PITA and I couldn't find a single Clojurian besides Alex who publishes stuff there 🙂

😁 1
Ingy döt Net 2024-05-06T20:58:48.710699Z

But I'll figure it out some day...