https://goo.by/5Puzv - Just tested some of the YS examples (https://rosettacode.org/wiki/Category:YAMLScript) and SnakeYAML (the Java lib under clj-yaml) has no probelm with them. 🙂
is yamlscript ultimately yaml? if so, would it be reasonable to use yamlscript to create yaml templates? it could make a nice alternative to helm while being emitting a manifest that people already send to k8s 😄
@hifumi123 yes. and it's interesting...
Did you happen to watch my talk?
Not yet. I am assuming that is the youtube link in the channel topic?
One of the things I show near the start is a YS program that prints out some data in YAML
and then at the end I show how you can load a .yaml file written in YAMLScript and have it execute to produce the result.
In that case the foo.yaml file starts with:
--- !yamlscriptAnd you need to use a YAML loader that is aware of how to process that tag
imho, that's what you would want... • To declare with an explicit tag that the following node is YS • To use a YS aware loader to load it
but then you have the full power of clojure 🙂
and data structures in YAMLScript are also coded as YAML
def data =: !
foo: 1
prn: 2
prn: datathe first prn is just a string key
Yeah, I remember seeing something like that in the README of the github repo, and it’s what sparked the idea of templating with YAMLScript in my mind 😄
the ! tag says the following node is data
def data =: !hash-map
foo: 1
prn: 2
prn: data
would also work as would:
def data =:
'foo': 1
'prn': 2
prn: data@hifumi123 right. This is one thing that I think will make YS become well adopted. The rub is that we need a Clojure platform in every language this is needed.
That's what Lingy is going to do 🙂
I see. At first I was confused at whether Lingy and YAMLScript were “orthogonal”, so to speak. But now it’s all starting to make sense to me. Thankfully, my end goal is just “write some clojure functions and create yaml data” without having to resort to things like nindent and related string manipulation tools in https://pkg.go.dev/text/template
Yeah it's been an interesting journey to get here. At first I thought of YS a year ago and made a toy one. Then I realized to write a lisp I had to know how lisp works. I googled and found https://github.com/kanaka/mal/blob/master/process/guide.md with almost 100 implementations https://github.com/kanaka/mal/blob/master/process/guide.md I took 2 weeks to do that project in Perl and then decided to make Lingy (using my Mal implementation as a start)
Starting with Mal was both good and bad so far. The macro expansion and TCO parts have been great so far, but taking on clojure namespacing was hard.
All the YS classes are subclasses of Lingy classes in the implementations
and only YAMLScript::Reader has any serious amount of code to it
porting that to Clojure will be a big next step.
and fairly simple
@hifumi123 where are you using yaml mostly now?
Pretty much just Helm and anything related to k8s ecosystem
with Go code involved?
Sort of… so Helm uses that golang package I linked above in order to let users define helper functions (written in go) or use pre-existing ones like nindent and printf and default and what not
I'd love to see Helm fall away like an old scab 😂
Oh yeah, me too
I have had to deal with adding some features to a Helm chart recently and it was frustrating. I know the Clojure world has at least one solution to this, but it doesn’t exactly have native YAML data structures https://github.com/barracudanetworks/lighthouse
The main problem with pushing YS forward right now is that Lingy is so young (and also only in Perl)
But if it works with all of JVM and JS then we can really move fast
well, the value i see in lingy is that basically every unix box out there has at least perl 5.18 or some later version 😛
so if lingy can target an “old enough” perl version, there may be very little users have to do to get it running
Except Centos 6 😉
good point.
it targets 5.16.0
which is the core maintainers (new as of April) target perl version
we made the decision for perl to have a 10 year rolling eol window
instead of 5.8.1 forever 🙂
I want Lingy to run clojure/core.clj entirely by the end of the year
The Lingy/Perl is kind of a test run to make a blueprint of how to make a clojure anywhere
@pez and I were talking about starting a make-a-clojure project
I just made #make-a-clojure if anyone has interest 😄
Sounds interesting. I am not going to make my own Clojure dialect any time soon, but I did see this talk at Clojure/conj and it was pretty good: https://www.youtube.com/watch?v=Yw4IAY4Nx_o
Yep. Saw that one.
He mentions working on jank for 7 years. I'm hoping to fast track that 😄
Where/When is the next Conj?
This year's was April 27-28 IIRC. We'll have to wait until next year for another one
https://komamitsu.medium.com/how-to-create-a-shared-library-from-java-code-2273b5015689
🎉
I should try a https://www.meetup.com/seajure/
@hifumi123 I forgot that I made this module https://metacpan.org/pod/YAML::PP::YAMLScript 🙂
ie the YS aware YAML loader.