Skip to content

Conversation

@mauro3
Copy link
Contributor

@mauro3 mauro3 commented Mar 5, 2019

This is an attempt to fix #26 by making BSONDict its own type. I suspect that something like this could work, but this doesn't. It fixes the behavior seen in #26 but the loading does not work yet.

Unfortunately, I don't have time to tinker more, but maybe someone else does?

@mauro3 mauro3 changed the title WNIP: Fix of #26 WnotIP: Fix of #26 Mar 5, 2019
@mauro3
Copy link
Contributor Author

mauro3 commented Mar 22, 2019

Cool, works now. Thanks to @Roboneet to fix the fix!

@mauro3 mauro3 changed the title WnotIP: Fix of #26 Fix of #26 Mar 22, 2019
@mauro3
Copy link
Contributor Author

mauro3 commented Apr 5, 2019

Bump

@GregPlowman
Copy link

Would be good to have this fix, or is there something blocking?

@CarloLucibello
Copy link
Collaborator

bump

@MartinusR
Copy link

I just ran into this bug today. Is there anything I can do to get this merged?

@mauro3
Copy link
Contributor Author

mauro3 commented Jun 5, 2020

Ping @dhairyagandhi96

@DhairyaLGandhi
Copy link
Collaborator

Quick look seems to ask whether adding a MacroTools deep is worth the few lines of code it can save

@MartinusR
Copy link

MartinusR commented Jun 5, 2020

Alternatively, from what I understoood from the code, it seems that just adding this line
lower(x::BSONDict) = BSONDict(x)
without redefining BSONDict solves the problem without breaking the tests. Though, this seems far less robust than mauro3's solution, and I may have missed some other use of lower.

EDIT: For the sake of completeness, I added a pull request with this alternative, so that you can judge by yourself.

@MartinusR MartinusR mentioned this pull request Jun 5, 2020
@mauro3
Copy link
Contributor Author

mauro3 commented Jun 8, 2020

@dhairyagandhi96: where do you see a MacroTools dependency?

end
# implement some of the needed Dict methods
Base.length(bd::BSONDict) = length(bd.d)
Base.isempty(bd::BSONDict) = length(bd.d)==0
Copy link

@GregPlowman GregPlowman Jun 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should isempty be a direct delegation?
Base.isempty(bd::BSONDict) = isempty(bd.d)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

@DhairyaLGandhi
Copy link
Collaborator

All the overloads for BSONDict remind me of doing everything in one line with MacroTools.@forward

@mauro3
Copy link
Contributor Author

mauro3 commented Jun 9, 2020

Ah, now I get it, the other way around you mean. And no, I don't think it is worth it. The code as it stands is very readable.

@CarloLucibello
Copy link
Collaborator

@DhairyaLGandhi could you merge this or the alternative #73? Would you also consider granting some of the past contributors write access? A lot of good work has been rotting in this repo for too long

@CarloLucibello
Copy link
Collaborator

actually, I would merge #73 instead for the sole fact that it comes with a test

@racinmat
Copy link
Contributor

If we merge this, I can make separate PR with tests so we have the fix there and tested.
cc @DhairyaLGandhi

@DhairyaLGandhi DhairyaLGandhi merged commit 1c40e5d into JuliaIO:master Feb 17, 2021
@DhairyaLGandhi
Copy link
Collaborator

Be good to test as well @racinmat ! Thanks!

@CarloLucibello
Copy link
Collaborator

Tag a release?

@DhairyaLGandhi
Copy link
Collaborator

DhairyaLGandhi commented Feb 17, 2021

Once the tests land? ref #29 (comment)

@DhairyaLGandhi
Copy link
Collaborator

Seems to have caused a bug in #84, so reverting for now

@mauro3
Copy link
Contributor Author

mauro3 commented Feb 27, 2021

Oops, sorry about this. But note that I will probably have time to look into this.

@CarloLucibello
Copy link
Collaborator

@mauro3 if you have time to look into #89 that would be great, I have no clue of how this package works

mauro3 added a commit to mauro3/BSON.jl that referenced this pull request Mar 1, 2021
Hopefully correctly this time around, first take was PR JuliaIO#29.
mauro3 added a commit to mauro3/BSON.jl that referenced this pull request Mar 1, 2021
Hopefully correctly this time around, first take was PR JuliaIO#29.
@mauro3 mauro3 mentioned this pull request Mar 1, 2021
@mauro3
Copy link
Contributor Author

mauro3 commented Mar 1, 2021

Aright, I fixed the issue in #90 (I hope).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

saving with bson modifies dict argument

7 participants