[erlang-questions] beginer: How to specify multifunction in edoc

Fredrik Thulin ft@REDACTED
Mon Oct 29 09:45:24 CET 2007


Hynek Vychodil wrote:
> No, it isn't what I really want. I want something like this:
> 
> http://erlang.org/doc/man/ets.html#update_counter/6
> 
> But where all parameters changes and only some parameters types works together.
> 
> open(File::file_handler(), Procs::integer()) -> {ok, handler()}
> open(FileName::list(), BlkSize::integer()) -> {ok, handler()}
> 
> But open(File::file_handler(), BlkSize::integer()) and
> open(FileName::list(), Procs::integer()) are nonsense. I want write it
> in @spec tag and I wouldn't like use open(FilenameOrHandler,
> ProcsOrBlkSize) because only two from four combinations have mater.

I'd like to suggest that you instead make two different functions,

   open/2
   open_fh/2

or similar... that would both make your interface cleaner (IMO), and 
solve the documentation issue =).

/Fredrik



More information about the erlang-questions mailing list