Fork me on GitHub
#clj-commons
<
2022-09-15
>
slipset10:09:09

Yeah, but that failure totally fine when building a PR.

slipset10:09:18

Of course, it should perhaps not fail.

borkdude10:09:19

@slipset I hate YAML, but I do care about the quality of clj-yaml because it is part of #babashka. Would you mind if I added myself to CODEOWNERS or would you rather review/merge PRs on your own, now that @marc-omorainis no longer very active in the Clojure community? Perhaps @lee is also open to this as a helpful companion.

Marc O'Morain10:09:48

I also hate YAML 😅 I think Circle uses it because Travis uses it, because Rails uses it.

Marc O'Morain10:09:56

So we can blame DHH really.

😂 1
borkdude10:09:42

@marc-omorain Maybe it's time to update your profile description? :)

lread11:09:01

Ya, sure I can lend a hand there. Sign me up!

borkdude11:09:09

Thanks! ❤️ I've given you admin access and added you to https://github.com/clj-commons/clj-yaml/blob/master/.github/CODEOWNERS

lread11:09:30

I find YAML annoying too. I tend to struggle when I have to use it but never really read any details about it. Thus thread just lead me to google which lead me to learn that you can use node anchors in YAML. Huh!

borkdude11:09:28

@lee There are many "interesting" bits in YAML. I think the most pressing issue is this one now: https://github.com/clj-commons/clj-yaml/issues/35

borkdude11:09:20

This caused a breaking change 😱

Marc O'Morain11:09:22

The Snake YAML maintainer is a character.

lread11:09:34

But...but... we don't have breaking changes in Clojure!?!

borkdude11:09:19

@lee That's the thing: we could "fix" this in the clj-yaml lib. So the dilemma is: follow the (crazy) YAML 1.1 spec or protect people from this breaking change

Marc O'Morain11:09:33

I submitted a patch to fix a NPE in SnakeYaml a few years back. He accepted the patch and said a new version would be released in 6 months time.

Marc O'Morain11:09:48

He only releases twice a year. 🤷

borkdude11:09:59

Yeah, that guy...

borkdude11:09:18

I think people who have invented YAML come from a different universe

lread11:09:30

He seems maybe a bit on the gruff side.

slipset11:09:05

Wouldn’t you be too if your hobby was to maintain a YAML parser?

borkdude11:09:39

Maybe also a cultural difference...

lread12:09:07

Ha! Probably @slipset!

lread12:09:02

http://yaml.org lists other java implementations:

Java:
  - SnakeYAML Engine  # Java 8+ / YAML 1.2
  - SnakeYAML         # Java 5 / YAML 1.1
  - YamlBeans         # To/from JavaBeans. YAML 1.0/1.1
  - eo-yaml           # YAML 1.2 for Java 8. Packaged as a Module (Java 9+)
  - Chronicle-Wire    # Java Implementation
I see some discussion of SnakeYAML Engine... perhaps other projects are good and also more pleasant to work with?

borkdude12:09:13

sure, but clj-yaml is built on snakeyaml, you can't easily change that. maybe we're able to get away with moving to snakeyml engine, don't know

lread12:09:48

So YAML 1.2 is a breaking change from YAML 1.1?

borkdude12:09:23

of course, what did you expect, backwards compatibility with a minor version number update?

lread12:09:49

Ha! Ok, weird reality.

borkdude12:09:12

The changes might be for the better in 1.2 though and I don't think it will affect many programs: https://yaml.readthedocs.io/en/latest/pyyaml.html#defaulting-to-yaml-1-2-support

borkdude12:09:29

but you never know of course

borkdude12:09:42

I think many tools are stuck on 1.1

lread12:09:14

I can ramp up on this issue if that helps. At the very least we'd have one more person who has a better understanding.

borkdude13:09:41

@lee yes please! My preliminary proposal was to add an option to control the weird octal parsing

borkdude13:09:00

this can be done using a custom Resolver, or so but I haven't really looked

lread13:09:28

Ok, I'll take a look-see.

lread19:09:01

I take back my “gruff” judgement, I think it was unfair.

borkdude19:09:57

Well, I'm certainly a gruff sometimes, aren't we all on some days

❤️ 1
Marc O'Morain19:09:37

> Wouldn’t you be too if your hobby was to maintain a YAML parser? This made me snort.

😄 3
lread21:09:29

I think I was gruff to say he was gruff. simple_smile

grzm02:09:46

For what it's worth, I actually don't care about parsing. I care about emitting.

grzm02:09:16

cheers. this whole thing is hateful, so I appreciate the diligence and attention to detail.

lread02:09:02

I think you made a good argument there btw!

grzm02:09:58

(I think gmail broke for me, so I'm no longer receiving email updates to all of this wonderful discussion, so thanks for pointing me to these updates)

grzm02:09:27

Does the resolver handle dumping as well?

lread02:09:17

Don’t think so. My current understanding is that we could create a custom resolver to ignore octals. Have not tried it yet, I guess they would default to strings.

lread02:09:14

Andrey said we might want to look at timestamps too, but I’m not sure why yet.

grzm02:09:53

For my really limited use-case, I'm dumping values via snakeyaml/clj-yaml/babashka (YAML 1.1) and reading them using js-yaml (YAML 1.2) (in CDK). One of our AWS accounts has a leading zero. AWS account ids are number-like strings, so that one with a leading 0 is being emitted without quotes by clj-yaml and being read as a number in js-yaml, dropping the 0 (and being a number)

grzm02:09:20

So, for me, the snakeyaml/clj-yaml resolver/parser never enters into the picture.

lread03:09:32

Ah. So is js-yaml maybe using yaml 1.2?

grzm03:09:39

It definitely is. And they noted the behavior difference in one of their updates.

lread03:09:50

Hmm… that was a nasty booboo with the octals in yaml 1.1 spec. And breaking change in yaml 1.2 spec.

grzm03:09:26

Yeah. Rich's Spec-u-lation talk really crystalized so much of those ideas for me back in the day. Hard for me to see things any other way at this point. Well, I can see it, I just can't bring myself to agree that it's a good idea to have breaking changes.

lread03:09:32

Smart Fellah that Mr Hickey!

grzm03:09:41

Hammocks all around.

hammock 2
borkdude09:09:21

@U0EHU1800 Awesome reply in that repo, I admire your patience

grzm13:09:30

I'm cautiously optimistic. I don't see any indication that any PR wouldn't be rejected outright based on principle that things are just find as they currently are in 1.30, but then again I don't see any indication that it necessarily would be either. I can't tell whether he's sympathetic to any of the arguments I put forward.

borkdude13:09:20

Given the 6 month release cadence I'd say we will fix it in clj-yaml anyhow?

grzm13:09:22

So, now the question for me is whether to put the time in to learn the snakeyaml code well enough to make a reasonable PR. My immediate use-case can be avoided by switching to json. I do think it's a regression in the upstream library so ideally I'd provide the fix there for The Good of All™ (😆).

❤️ 1
grzm13:09:51

Good point re: release cycle and fixing it for now. I was trying to figure out how that would be done in clj-yaml. I'm not sure how to override the provided emitter behavior. Maybe override the representer? I was looking a bit last night and it wasn't immediately obvious.

borkdude13:09:45

I'd love to see it being fixed in snakeyaml

borkdude13:09:02

you could find the commit that caused the regression to see how to fix it maybe?

Marc O'Morain13:09:14

Does anyone want to write their own YAML parser ?

Marc O'Morain13:09:41

Joking but also not joking.

borkdude13:09:45

as a hobby?

Marc O'Morain13:09:00

Yeah, but it depends on the scope. Writing a JSON parser is pretty easy. I've written a few in the past for fun. That wouldn't daunt me. Writing a YAML parser is probably a horrifically large task.

borkdude13:09:46

I was referring to the gruff part before when I said as a hobby ;)

borkdude13:09:08

I have considered it, but no

borkdude13:09:30

The only reason I care about clj-commons/clj-yaml is that its part of bb and I don't want bb to behave wrong with respect to people's builds

borkdude13:09:46

but I'm not that invested in yaml that I actually want to put that much time in it

borkdude13:09:16

I mean, getting the first 80% right is probably easy. But then becoming spec-compliant with all the quirks is where it gets "fun"

Marc O'Morain13:09:50

Oh yes. So many quirks I bet. The CircleCI Yaml loader has to check for things like loops, which are possible in YAML.

borkdude13:09:03

clj-yaml supports those loops via lazy-seqs ;)

Marc O'Morain13:09:50

We also had a bug where someone was able to create a map with two keys, both of which were null, with 2 values, which were also null.

slipset10:09:23

Please do add yourself to the code owners. Would be much appreciated!