[erlang-questions] type specs to guards, anyone?

Kostis Sagonas <>
Wed Jan 13 18:52:52 CET 2010


Ulf Wiger wrote:
> 
> Does anyone happen to be sitting on code that generates guard
> tests from type specs?

I am not aware of such code.

Moreover, I am not even sure what you want to do here.  The language of 
types allows for more things than what you can express using Erlang 
guards.  For example, you might have a function foo/1 whose argument 
should be a list of integers.

-spec foo([integer()]) ->

Using guards the only thing you can express is that foo/1 takes a proper 
list.  You need to be able to employ user-defined functions in guards to 
do it properly. Erlang currently lacks this.

Kostis


More information about the erlang-questions mailing list