BTW: I should say, I think the API is quite good given the decision to
conform to the errno/Posix stuff.

I personally don't really like so many "flags" floating around:
I'd rather see "open_input(filename)", "open_output(filename)" than
open(file, direction) -- but that's the way Posix/C tend to do things.

The reason is that in many cases, with specific function names,
control flow (which is relatively easy to visualise and reason about)
dictates the state of a file handle, whereas with the flags, you need
to do data flow analysis as well.

In particular (carrying on the file example), one can do:

        open_input -> filename -> input_file
        open_output -> filename -> output_file

and now the type system can ensure you can't write on an
input_file. Now, if you want to recover the flag based semantics,
and you have a real programming language like Ocaml, Felix,
Haskell or such, you can make a function that returns an
input or output file based on a flag, but the result then has
to be a sum type (union, variant) and still can't be used improperly.


--
john skaller
[email protected]




_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to