-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Remove unused base64.encode
overload
#20369
Conversation
Do we know why this procedure was added in the first place? |
Is it ok to have an overload for integer types of arbitrary sizes. Shouldn't the input be byte strings. |
Please add a changelog entry, then this can be merged.
Is this a question? And if so, what code are you referencing? |
Is this needed, from the user's perspective nothing changed.
Yes, https://github.com/nim-lang/Nim/pull/20369/files#diff-cc4f63a53ac195237326427c11b84c89967c417d474b4cd55ad54b48a09c9a1cL144. |
Can you give an example of what happens with 1-byte integers, vs multi-byte integers? |
import std/base64
var x = @[72, 101, 108, 108, 111] # Hello
let e = encode(x)
x[0] += 256
assert encode(x) == e |
Hm. I don't know.
Both are breaking changes, though the current behavior is arguably a bug. I would implement #2 first, and see how many, if any, packages that breaks. |
I tried |
for reference, the API we use is: https://github.com/status-im/nim-stew/blob/master/stew/base64.nim (notably, there are many "base64" alphabet standards) |
Should I change |
Why doesn't it work ? |
cc @Varriount ^. |
Instead of |
@Araq, What about code like |
@Araq is this fine ? |
I think so but there is no RFC for it so better leave it as it is. |
Can this be merged now ? |
lib/pure/base64.nim
Outdated
@@ -144,40 +146,23 @@ template encodeImpl() {.dirty.} = | |||
proc encode*[T: SomeInteger|char](s: openArray[T], safe = false): string = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So ... you left this one as SomeInteger
? Bad idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Araq, What about code like encode @[111, 113, 32] ? should it be deprecated ?
I think so but there is no RFC for it so better leave it as it is.
So code like that just breaks ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, so can you explain why this procedure was left as-is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, so can you explain why this procedure was left as-is?
@Araq, What about code like encode @[111, 113, 32] ? should it be deprecated ?
I think so but there is no RFC for it so better leave it as it is.
" leave it as it is"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Araq please clarify what you want:
T: byte|char
T: byte|char
and deprecateT: SomeInteger and not byte
T: SomeInteger|char
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(2)
@Araq merge this please. |
Thanks for your hard work on this PR! Hint: mm: orc; opt: speed; options: -d:release |
* Remove unused `base64.encode` overload * [skip ci] Remove commented code * [skip ci] var -> let * [skip ci] Remove mentions of the string overload * Remove `SomeInteger` overload * Fix CI * Fix CI * Deprecate `SomeInteger` overload * [skip ci] Add changelog entry * Revert "Remove `SomeInteger` overload" This reverts commit 79a2963. * Revert "[skip ci] Add changelog entry" This reverts commit 186f17e. * Revert "Revert "Remove `SomeInteger` overload"" This reverts commit 8005318. * Update lib/pure/base64.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
No description provided.