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

Hynek Vychodil <>
Mon Oct 29 08:19:14 CET 2007


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.

--Hynek (Pichi) Vychodil

On 10/28/07, Michael McDaniel <> wrote:
>   see http://autosys.us/misc/vipin.html function foo/2
>   also http://autosys.us/misc/vipin.erl
>
>   if I understand correctly your question...
>
> ~Michael
>
>
> On Sun, Oct 28, 2007 at 03:18:28PM +0100, Hynek Vychodil wrote:
> > Hello,
> > I don't know how to write specification of function with many
> > patterns. For example how to specify this simple function
> >
> > foo(X, Y) when is_integer(X), is_integer(Y) -> true;
> > foo(X, Y) when is_atom(X), is_atom(Y) -> false.
> >
> > What should I write when I want to see in documentation that there
> > must be both parameters same type. I would like see in documentation
> > some like
> >
> > foo(X::integer(), Y::integer()) -> true;
> > foo(X::atom(), Y::atom()) -> false.
> >
> > Best
> > -- Hynek (Pichi) Vychodil
> > _______________________________________________
> > erlang-questions mailing list
> > 
> > http://www.erlang.org/mailman/listinfo/erlang-questions
> >
> > !DSPAM:52,47249a5450981775114153!
> >
> >
>
> --
> Michael McDaniel
> Portland, Oregon, USA
> http://autosys.us
> +1 503 283 5284
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list