truemedian / luvit-api-design

11 stars 2 forks source link

`querystring` and `json` function names #3

Open RiskoZoSlovenska opened 2 years ago

RiskoZoSlovenska commented 2 years ago

Luvit 2.x's json module provides the functions stringify() and parse() as aliases to the encode() and decode() functions. Node.js's querystring module does the same (technically, the latter are aliases for the former), but Luvit's querystring function only defines stringify() and parse(). Luvit 3.0 would be a good time and place to decide what to name json's and querystring's functions - whether to provide both sets, or just one.

RiskoZoSlovenska commented 2 years ago

If I am to throw in my two cents, I personally prefer only having encode()/decode() - their names are similar and obvious, and the lack of aliases reduces confusion.

truemedian commented 2 years ago

I've started with this in ba42b05, and I agree with using encode/decode over stringify/parse as it makes the link between them more obvious

RiskoZoSlovenska commented 2 years ago

Keeping only encode/decode may be a challenge with the json module, unless we want to not offer an unmodified copy of dkjson like 2.x does.

truemedian commented 2 years ago

What happens to json depends on if we add a better json implementation in luvi itself (like cjson)