[erlang-questions] Request feedback on example project

Richard A. O'Keefe ok@REDACTED
Thu Feb 4 04:35:26 CET 2016

UUID support in various flavours of Unix is ridiculously spotty,
so I've been looking for a readable implementation for a while.

In particular, the support for all of versions 1-5 looks useful;
the C libraries available to me do not do that.

I will say that stuffing curly braces around the UUID by default
is both surprising and unhelpful; it's probably a bad idea for
there to *be* a default.

The version of Erlang I have installed doesn't support maps.
I was trying to install 18.2 today but ran into problems (see
earlier message from me today).  So I cannot compile zuuid.
(The RestartStrategy is given as a map in zuuid_sup:init/1.)

Speaking of documentation, while init/1 may be a private
function, that doesn't mean that someone who isn't highly
skilled in OTP wouldn't benefit from an explanation of *why*
the flags and child spec are what they are.

Suppose that getifaddrs() returns a list in which no element
contains an hwaddr.
- If the list is entirely empty, {error,no_iface} results.
- If the list is not empty, {error,no_address} results.
Why are these different?

I note that the example for get_hw_addr/1 suggests
eth2, br1, birbr0, wlan0
as things to look for, none of which are reported on my machine.
(I have lo0, gif0, stgf0, en0, en1, en2, en3, p2p0, bridge0.)
Examples that don't work are always confusing.
What's particularly confusing for the new reader is "where does
this list of magic alphabet soup come from?  If none of this
works, is my machine set up wrong, or what?"
I note that this time, a non-empty list of interface addresses
that happens not to contain the one you are looking for will be
reported as no_iface, not no_address.

"The hardware addressed desired."
Should that be "address"?

It's probably there somewhere, but I haven't found it, so can I ask
that every module that can report {error, Reason} should either
document the Reasons explicitly itself, or point to a documented
catalogue from which it draws?

I wanted to report something profound and insightful, but these are
just a few comparatively unimportant things that bugged me when I
was reading the code.

Oh, a layout issue.  I don't like big black blobs (except when I
write them).  So
%% wdrwertwertwert
%% wertwertwertwrt
%% wretertwertwertew
-spec frgsdfgdfghsdfg
asdfasdf(sdfgsdfg) ->

is just a bit too much for me to be comfortable with.  I'd find
it easier to read with blank line after the %% comment block
and a blank line after the -spec.

I find that with my OWN code it's so obvious that packing it
tightly doesn't impair readability, but with someone else's
code well-placed blank lines never go amiss.  I can only suppose
that I'm in error about my own code and that it too could do with
more blank lines.

More information about the erlang-questions mailing list