[phobos] std.base64 replacement

Daniel Murphy yebblies at gmail.com
Sun Oct 10 03:20:00 PDT 2010


On Sun, Oct 10, 2010 at 5:06 PM, Masahiro Nakagawa <repeatedly at gmail.com>wrote:

> What do you think?
>
> Masahiro
>

So the only reason to re-write it was to change the license?

Some suggestions:

(API)

1. Convert the whole thing to a range based design.
ubyte[] <-> dchar range

2. Accept ubyte[] or void[] as well as string

3. Add a constant for no padding
maybe
enum NoPadding = '\0';

I think
alias Base64!('!', '=', Base64.NoPadding);
is a lot clearer and easier to use.

4. Rename Base64Impl to Base64 and add default arguments for the standard
character/padding settings.

(Style)

5. Reduce use of *ptr++ style code in favour of foreach/ranges etc.

6. Use assumeUnique instead of casting arrays to immutable.

I think the entire thing should be @safe unless REALLY needed for speed.

Hope I've been helpful.
Daniel.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/phobos/attachments/20101010/57b0a594/attachment.html>


More information about the phobos mailing list