Shock horror

Martin Bjorklund <>
Mon Apr 29 13:46:07 CEST 2002


Joe Armstrong <> wrote:


>    Now this function calls 
> 
> 	systools_lib:file_term2binary/2
> 
>    and I could not understand why the code for this had been placed in
> a *different* module - surely *nobody* would want to call
> systools_lib:file_term2binary/2 - it's so obscure that nobody would
> ever think to use it. And it's not even documented (systools_lib) has
> no man pages - so the chances that anybody would ever even think of
> using this function are minuscule.

I can't answer for that particular function, but surely you can't mean
that singletons are so bad?  One case that someone mentioned is when a
function is part of the documented API.  Another case is when you
structure you're application in a set of modules, with just one (or a
few) "exported" modules.  The rest of the modules are internal.  An
example of a singelton function could be a function which encapsulates
a call to an internal server.  Another example would be when a
function (which is called just once) logically belongs to a specific
module.

Of course a better module system could make things look better, but
personally I don't think it's a big deal.


/martin



More information about the erlang-questions mailing list