Skip to content
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

Choose a default for ambiguous formats #38

Merged
merged 4 commits into from
Sep 28, 2015
Merged

Conversation

timholy
Copy link
Member

@timholy timholy commented Sep 28, 2015

save("myfile.ppm", img) used to generate an error, because there are two formats (:PPMBinary and :PPMText) defined. Users will rarely care, and in almost all cases you want :PPMBinary anyway. So I changed the behavior from "throw an error upon creating a new file when the format is ambiguous" to "choose the first one in the list".

I also provided a new mechanism for forcing the format: save(format"PPMBinary", "myfile.ppm", img). You might have thought that save(File(format"PPMBinary", "myfile.ppm"), img) would have been the better choice, but that runs into a problem: unless the (new) Netpbm.jl package has already been manually loaded, it falls back to the "error: no saver defined for ..." method. So we need a method with distinguishable signature, and this seemed to be the obvious one.

@SimonDanisch
Copy link
Member

I tried to debug this but seems like it's better if you fix that error.
I guess mapinfo is only defined for Gray{U8} ?
But then I ran into a method error with mybswap(::Gray{U8}), which is where I decided to stop^^

@timholy
Copy link
Member Author

timholy commented Sep 28, 2015

Ah, it's fixed locally but I need to push.

@SimonDanisch
Copy link
Member

rest seems to work fine!
I'm definitely in favor of your proposal.
Back when we had that discussion I was just happy that there is already a solution, but this is definitely better =)

This will make sure it's last in the chain
timholy added a commit that referenced this pull request Sep 28, 2015
Choose a default for ambiguous formats
@timholy timholy merged commit 7da378d into master Sep 28, 2015
@timholy timholy deleted the teh/ambiguous_formats branch September 28, 2015 18:03
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.

None yet

2 participants