-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
new Base64 encoder and decoder #24285
Conversation
Very nice!! Also needs entries in doc/make.jl. |
Markdown's rich renderer indirectly depends on the base64 encoding function here: julia/base/markdown/render/rich.jl Lines 12 to 13 in d3afdfd
|
Move Markdown to stdlib too? |
That sounds unlikely to me since Markdown is tightly bounded to the documentation system. But some rich renderers like this may be separable from Base. |
Maybe keep the new implementation in Base for now, then we can work out how/whether to refactor it in a separate PR. |
Since @bicycle1885 has already done most of the work to move it out – which is in my view the more important change – why not just carry on until we're done here? We can change Base64 implementations any time but moving the API out of Base needs to happen as soon as possible. |
@StefanKarpinski, how do you propose to move it out if markdown rendering depends on |
We should move |
@StefanKarpinski, but isn't at least the |
There usually isn't anything wrong with type piracy. I haven't thought much about the best way to factor this particular code, but the type piracy in this case seems harmless. |
I don't know when parsing of docstrings happens, but if it is possible to parse them lazily, it might be possible to move |
Started looking at this a bit. I think we should separate the Docs module into code for writing doc strings vs. code for searching and displaying doc strings --- similar to how the code for building HTML manuals is a separate package (Documenter). Doc strings are already parsed lazily, we just need to better separate the code that uses the parsed representation. Then it would be easy to move Markdown and Base64 out of Base. |
#24361 should be a version of this that can be merged immediately. |
This is a rewrite of the current base64 encoder and decoder tools. The implementation is placed in the stdlib directory so that we can deprecate the old tools as per #24222. This pull request will finally deprecate the current tools but it is not yet done.
The performance is also improved, really, dramatically, though there is still more room for fine-tuning:
Some open problems I found while writing it:
Base64
orbase64
prefixes? They are now under theBase64
module so their prefixes are almost redundant.base64
module of Python 3.6.1 requires padding.I believe this is a bug and should not be retained in the new implementation.