[zeromq-dev] Requesting suggestions for getsockopt() in Java
Steven McCoy
steven.mccoy at miru.hk
Mon Aug 9 16:15:29 CEST 2010
On 9 August 2010 22:01, gonzalo diethelm <gdiethelm at dcv.cl> wrote:
> I have two questions:
>
> 1. How to properly implement a method that could return two types of
> values (int and String)? It could always return Object, but that would
> force the caller to use Integer, not int, and to do explicit casts. Or
> it could be split into two separate methods: getIntSockopt() and
> getStringSockopt(). As I said somewhere else, ugly as a mother in law...
> 2. Should these methods be "properly" capitalized, Java style? By that I
> mean setSockOpt(), getSockOpt(), etc.
>
>
As always, just copy Sun's original implementation, implement getters and
setters for every socket option:
http://download-llnw.oracle.com/javase/1.4.2/docs/guide/net/socketOpt.html
The entire point of the BSD socket API is to reduce the learning curve and
so for every target language the ZeroMQ API needs to follow the native BSD
socket interface otherwise it introduces an additional learning step and
inconvenience.
Also as noted here,
http://www.zeromq.org/docs:bindings
"Name formatting should be chosen according to common practice in the
particular language: lower-case with underscores, camel-case etc."
--
Steve-o
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100809/5d7351dc/attachment.htm>
More information about the zeromq-dev
mailing list