You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Listen to HTTP requests and start facil.iointmain(intargc, charconst**argv) {
// allocating values we use oftenHTTP_X_DATA=fiobj_str_new("X-Data", 6);
// listen on port 3000 and any available network binding (NULL == 0.0.0.0)http_listen("3000", NULL, .on_request=on_request, .log=1);
// start the serverfacil_run(.threads=1);
// deallocating the common valuesfiobj_free(HTTP_X_DATA);
}
And, at least for me, using 3 different prefixes (http, fiobj, facil) appear a bit unintuitive.
What about all prefixes being just http_?
In this way we don't need to remember each functions should use this or that prefix. The learning curve is smaller, and hence the adoption can be bigger.
Just an idea.
Another thing is this line:
FIOBJHTTP_X_DATA;
Generally in C we use uppercase letters for constants, but this is a variable.
The typedef is also in uppercase. A bit unusual for me.
But this can be less important.
Cheers,
The text was updated successfully, but these errors were encountered:
This appears to be an issue related to the 0.6.x API if I am correct.
In 0.7.x versions you will find more consistency. All facil.io core functions where moved to the fio_ namespace (prefix).
As for merging all namespaces to a single namespace, I believe this would be a mistake.
The facil.io library is a modular library. The facil.io core isn't limited to HTTP services, and can be easily compiled without the HTTP services extension.
Also, facil.io and it's extensions provide quite a large number of functions. When using an IDE, the different namespaces / prefixes empower the auto-complete feature to make meaningful suggestions in less time.
As for going forwards and suggesting further improvements towards the upcoming 0.8.0 API, please feel free to join the discussion in issue #60. It would be great to read your opinion on these issues.
Kindly,
Bo.
P.S.
In this specific case, the HTTP_X_DATA is a constant, it's just not a compile-time constant and has to be initialized (and eventually destroyed) during runtime.
The FIOBJ type name started as a macro and I've kept it this way because I want to be able to change the implementation easily (without changing the name or breaking existing code).
First, congratulations for the work!
I was seeing the example usage:
And, at least for me, using 3 different prefixes (
http
,fiobj
,facil
) appear a bit unintuitive.What about all prefixes being just
http_
?In this way we don't need to remember each functions should use this or that prefix. The learning curve is smaller, and hence the adoption can be bigger.
Just an idea.
Another thing is this line:
Generally in C we use uppercase letters for constants, but this is a variable.
The typedef is also in uppercase. A bit unusual for me.
But this can be less important.
Cheers,
The text was updated successfully, but these errors were encountered: