-
Notifications
You must be signed in to change notification settings - Fork 47
i) write instances of AbstractDict instead of Dict; ii) YAML.yaml returns a String. #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…urns a String. Writing AbstractDicts has the advantage that OrderedDicts become available for writing properties in a fixed order. YAML.yaml is an alias for YAML.write, which complies with the API of JSON.jl
Codecov Report
@@ Coverage Diff @@
## master #86 +/- ##
==========================================
+ Coverage 74.30% 74.56% +0.26%
==========================================
Files 12 12
Lines 1331 1333 +2
==========================================
+ Hits 989 994 +5
+ Misses 342 339 -3
Continue to review full report at Codecov.
|
|
This all makes sense to me, but I'm not a big user of this package. I'll merge in a couple of days if there are no objections so that it doesn't languish, but can you maybe post on slack or zulip or discourse to see if there's any feedback from people that are actually using it? |
|
What exactly should I ask? My motivation to open this PR was mostly the last point I mentioned: taking a step towards #70. What I did not yet mention is that, besides the trivial JSON.jl allows the user to pick the subtype of Some users of YAML.jl have discussed this behaviour as a desireable feature since quite some time, in #29. With writing instances of The PR we are discussing here is nothing fancy, for sure, but it'll help get some other things done. |
Basically just - "can people that use YAML.jl take a look at this PR and provide feedback or raise concerns if you have them?" I'm sure it's fine, especially if you expect it to be non-breaking - I just don't have any experience with this package, and I'm worried that the people who do aren't watching the issues / PRs. |
|
I have no opinion either way about the |
|
@kescobo, how long do you plan to wait before merging? I want to continue with #70 (comment) but not before this PR is done |
|
All set 👍. |
These are two minor changes which are combined in a single PR because they can nicely be tested together.
Writing AbstractDicts
This feature solves #82. As pointed out in this issue, writing instances of
AbstractDictallows users to make use of ordered dictionaries likeOrderedCollections.OrderedDict. Thus, the user can determine in which order the properties are written.Note that none of the tests is broken (i.e. all test instances are written correctly) if the
Dictrequirement is dropped in favor ofAbstractDict. Hurray! I conclude that my initial implementation of writing YAML Strings (#68) was unnecessarily picky with theDicttype.YAML.yaml
YAML.yamlreturns a YAML-formatted String representation of a dictionary. It is implemented as a simple alias forYAML.write, which could have done the same thing already. The nameYAML.yaml, however, complies with the beautiful API of JSON.jl, which hasJSON.jsonreturn a JSON-formatted String representation of a dictionary.This feature takes a step towards #70 without making any breaking change (only an alias is provided). Also in #29, it has been argued in favor of a
YAML.yamlmethod: #29 (comment)