[erlang-questions] -spec Enhancement: -spec f :: ftype().

David Mercer <>
Tue Feb 14 17:14:21 CET 2012


You know, I've always wished I could declare a function type (e.g., -type
f() :: fun((arg_type1(), arg_type2()) -> return_type())) and then declare a
function as conforming to that spec (e.g., -spec f1 :: f()), instead of
having to repeat myself (i.e., -spec f1(arg_type1(), arg_type2()) ->
return_type()).  This helps when the function type is quite complicated and
needs to be repeated often, and also when you have a function that takes a
function with a certain spec, when you define the actual functions that can
be passed to it.  What do y'all think?  Am I crazy?

 

Cheers,

 

DBM

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120214/d1f6be71/attachment.html>


More information about the erlang-questions mailing list