jazzdotdev / jazz

The Scripting Engine that Combines Speed, Safety, and Simplicity
Apache License 2.0
146 stars 11 forks source link

base64 bindings #180

Open naturallymitchell opened 5 years ago

naturallymitchell commented 5 years ago

https://github.com/alicemaz/rust-base64

naturallymitchell commented 5 years ago

for https://github.com/foundpatterns/lighttouch-base/issues/111#issuecomment-449542353 base64.to_string() and base64.from_string() ? //cc @Arnaz87

dariusc93 commented 5 years ago

rename them from encode/decode to from_string/to_string?

naturallymitchell commented 5 years ago

let's see what Arnaud says first

Arnaz87 commented 5 years ago

Those names are consistent with the conventions yaml ans scl use, but in this case it's not very useful because both the input and the output are strings. I think here encoding and decoding are the winner terms.

Arnaz87 commented 5 years ago

Maybe to_base64 and from_base64, but I don't particularly like those aesthetically (because base64 is repeated and it's awkward to write and see... maybe), still vote for decode/encode

naturallymitchell commented 5 years ago

it has to be base64.whatever, right?

naturallymitchell commented 5 years ago

not to_base64 / from_base64, base64.from_string and base64.to_string

Arnaz87 commented 5 years ago

Not necessarily, it can be like the current lua library, a global to_base64 function. I still like encode more but this is much much better

naturallymitchell commented 5 years ago

which is much much better?

you like the current base64.encode / base64.decode ?

Arnaz87 commented 5 years ago

Yes, I like more base64.encode because it's in it's own module, but just to_base64 is also a nice option and it's shorter to write, not my first choice because creates a global function when i'd prefer all functions in modules. base64.to_base64 is just ugly.

naturallymitchell commented 5 years ago

base64.to_base64 was never an option

it's either base64.from_string, base64.encode, or to_base64

naturallymitchell commented 5 years ago

https://github.com/foundpatterns/lighttouch-base/issues/111 depends on this

Arnaz87 commented 5 years ago

I very much dislike from/to_string, because both the output and input are strings so the names are very useless to distinguish between them, but decode and encode are pretty clear given the definitions of those words, I prefer those by far.

dariusc93 commented 5 years ago

Are there anymore comments regarding the naming to base64 or can this be closed?

naturallymitchell commented 5 years ago

@dariusc93 which was your favorite syntax?

dariusc93 commented 5 years ago

Encode/decode looks fine to me as it is implemented now.

naturallymitchell commented 5 years ago

cool