There is a file format whose specification is written only in a GPL-licensed code. Is it okay for me to look at that code and create a function that writes in the same format in an MIT-licensed package?
I don’t think you can, this is clearly derived work, and must be under GPL as well.
One “easy” solution is to make that writer a separate package and use GPL only for that part of the code.
I don’t think there’s people on this forum with enough domain expertise to give a meaningful answer. The GPL is intentionally vague and hinges on copyright and its complex interpretations & interactions to make its claims.
GNU/The FSF itself (which is obviously biased into their interpretation) says:
What does the GPL say about translating some code to a different programming language? (#TranslateCode)
Under copyright law, translation of a work is considered a kind of modification. Therefore, what the GPL says about modified versions applies also to translated versions. The translation is covered by the copyright on the original program.
If the original program carries a free license, that license gives permission to translate it. How you can use and license the translated program is determined by that license. If the original program is licensed under certain versions of the GNU GPL, the translated program must be covered by the same versions of the GNU GPL.
Note that I have no idea under which jurisdiction and under which assumptions that text was written - presumably it was an US centric one.
There’s also the question about which GPL license exactly applies in your case, as there is such a thing called the linking exception, which permits dynamic linking of GPL code to non-GPL code. This is what @jling was probably thinking of with the suggestion of a wrapper.
If it’s a big concern to you, consult a copyright attorney who specializes in such matters and can give you guidance for your specific case.
Thank you for the replies.
You could have someone else read the code, write the specification in detail, then implement a reader for that format. This “clean room” implementation would be safely non-GPL.