3 ms·
Is your objection just to C++ syntax in general (in which case: total agreement) or something particular about OKWS? It seems pretty self-explanatory, as far a
by megrimlock 16y ago
Is your objection just to C++ syntax in general (in which case: total agreement) or something particular about OKWS? It seems pretty self-explanatory, as far as C++ goes:
okclnt_t *make_newclnt (ptr<ahttpcon> x);
This declares a function that makes a new client from an http connection. It returns a raw pointer, so I presume the caller is responsible for the client lifetime. Whereas the connection argument is some ptr template, which I expect is a ref-counted or otherwise managed pointer, which suggests the client will keep the connection object alive. This is copying the ptr value, which if this is a ref-counting ptr would do an unnecessary extra ref-count during the function call, so they might want to pass it as a const-ref instead.
okclnt_simple_t (ptr<ahttpcon> x, oksrvc_simple_t *o) : okclnt2_t (x, o), ok_simple (o) {}
This is a constructor to make a simple client from an http connection and a simple service. The only thing unusual is that a _t suffix usually suggests a typedef, and I don't think you can use a type alias to define a constructor.
I haven't looked at the API or done any web programming; I thought it was interesting what I could tell from this snippet regardless.
- zokier 16y agoI think my biggest gripe is that naming scheme. Is it really worth abbreviating "client" to "clnt" or "service" to "srvc". And single letter variable names, seriously?
- sedachv 16y agoIt reads a lot like those medieval manuscripts back when the European languages didn't have so many vowels in them. Maybe the OKCupid devs should take another page from the monks and get rid of whitespace as well. After all <strike>parchment</strike> horizontal screen space is a precious commodity.