-
Notifications
You must be signed in to change notification settings - Fork 189
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
Some minor API inconsistencies #399
Comments
Thanks for compiling this, I think it's really worthwhile to address this sort of stuff. Replying to your comment in #393 here RE: The most future proof way to bind Might be worth changing it to accept an integer, a string, or a table? That way it'd be easy to expand it if necessary in the future but the default would be to specify Relevant docs: |
Not really an inconsistency, but something I noticed when reading through the new docs:
|
For these, it is fine because libuv uses a
But for the rest of these, it's not clear why a Lua number is used: Libuv returns
Libuv returns
Libuv returns
Libuv uses: typedef struct {
int64_t tv_sec;
int32_t tv_usec;
} uv_timeval64_t;
Libuv uses: typedef struct uv_cpu_info_s {
char* model;
int speed;
struct uv_cpu_times_s {
uint64_t user;
uint64_t nice;
uint64_t sys;
uint64_t idle;
uint64_t irq;
} cpu_times;
} uv_cpu_info_t; |
Isn't this a more general problem? PUC Lua doesn't have the concept of |
Hmmm good point. There's no guarantee that a Lua integer is 64 bits or unsigned. |
I'm working on a much needed update to the luv docs. It's nearly done, but I want to highlight some API inconsistencies that I found. None of these seem to be a big deal, some of them are nitpicky, but I wanted to get this list here while I have it
uv.tty_set_mode
accepts rawtty_set_mode_t
enum instead of a lua stringuv.getaddrinfo
hints
take raw integer values (I think they are inuv.constants
?)compare to:
uv.run
mode accepts lua string instead of rawuv_run_mode
enumuv.udp_set_membership
accepts lua string instead of rawuv_membership
enumuv.poll_start
accepts lua string instead of rawint
for eventsuv.tty_set_mode
could optionally accept a string so that the change isn't breaking. Should we allow other enum-accepting functions to accept ints? Should we expose more enums atuv.constants
?uv.new_tcp
accepts rawint
for flagsuv.new_udp
accepts rawint
for flagscompare to:
uv.tcp_bind
accepts a table of booleans instead of rawint
for flagsuv.udp_bind
accepts a table of booleans instead of rawint
for flagsuv.fs_event_start
accepts a table of booleans instead of rawint
for flagsMight be fixed? See #393 and #398.
uv.getaddrinfo
returns table withaddr
,port
,family
compare to:
uv.getnameinfo
accepts table withip
,port
,family
uv.tcp_getpeername
returns table withip
,port
,family
uv.tcp_getsockname
returns table withip
,port
,family
uv.udp_getsockname
returns table withip
,port
,family
uv.udp_getpeername
returns table withip
,port
,family
You can't directly use a
getaddrinfo
result ingetnameinfo
, but would you want to?That's all I have for here. I'll be opening other issues or maybe PRs for things that I think deserve there own.
The text was updated successfully, but these errors were encountered: