Closed RiskoZoSlovenska closed 2 years ago
Thanks. Is it possible to have bin/lcmark test to see if lyaml is available and, if it is, use it instead of the default yaml?
Thanks. Is it possible to have bin/lcmark test to see if lyaml is available and, if it is, use it instead of the default yaml?
Alright, done.
On a related note, I'm starting to think it wouldn't be a bad idea if lcmark itself checked for the presence of other libraries and used whichever one was available. Only downside I can think of is maintainability. What do you think?
On a related note, I'm starting to think it wouldn't be a bad idea if lcmark itself checked for the presence of other libraries and used whichever one was available. Only downside I can think of is maintainability. What do you think?
Hm, not sure. That does seem tempting. As for the maintainability hit, do you mean because people will be running with different yaml libraries, making it harder to deal with bug reports, or because custom code will be required for each supported yaml parser? (If the latter, how much extra code would be needed?)
Hm, not sure. That does seem tempting. As for the maintainability hit, do you mean because people will be running with different yaml libraries, making it harder to deal with bug reports, or because custom code will be required for each supported yaml parser? (If the latter, how much extra code would be needed?)
It's not necessarily a lot of code.
The maintainability hit I meant was that this creates some assumptions about how certain libraries work, and if any undergo drastic API changes, this code will have to be updated. Looking at it now, though, it isn't as bad as I had initially feared.
Shall I add this to the PR?
Yeah, that's not too complicated. To reduce maintainability worries, we could cut down on the number of libraries searched...maybe limiting it to the highest quality C parser and the highest quality pure Lua one. And why not try lyaml first, since it's higher quality?
Yeah, that's not too complicated. To reduce maintainability worries, we could cut down on the number of libraries searched...maybe limiting it to the highest quality C parser and the highest quality pure Lua one.
So lyaml
, lua-yaml
and yaml
?
And why not try lyaml first, since it's higher quality?
Fair point.
Sounds good to me.
An alternate implementation of https://github.com/jgm/lcmark/pull/5.
This PR adds a new
yaml_parser
option (a function) that, if provided, will be called instead ofyaml.load
. When not provided, lcmark will try to load theyaml
library at runtime and use that.Since
yaml
conflicts with most other Lua YAML libraries (lyaml
,lua-yaml
), this PR also removes it from the rockspec dependency list and adds a note to the README.