[erlang-questions] Intel Quad CPUs

Kostis Sagonas kostis@REDACTED
Thu Sep 6 22:54:01 CEST 2007


Damien Morton wrote:
> +1 on less syntactic clutter.
> 
> The /2-ness of foo is clear from the remainder of the type specification
> 
> There are redundant parentheses too - are they neeed?
> 
> -spec(foo :: (integer, float) -> atom)
> 
> just reads better to me
>> On Tue, 4 Sep 2007, Kostis Sagonas wrote:
>>  
>>> In the new language you would write (or preferably change the above edoc
>>> comment to be):
>>>
>>> -spec(foo/2 :: ((integer(), float()) -> atom())).
>>>     
>>
>> What is the reason for the trailing ()s? It would be nice if the syntax
>> had less redundant visual noise.

I very much agree with this wish, but:

   1. As mentioned in some other post in this thread, types like the
      following one are also allowed

		{ok, integer()} | {error, string()}

      and there needs to be way to distinguish between atoms (i.e.
      singleton types) and type names.

  2. We want to be as much as possible compatible with edoc.

  3. Some types can also take parameters. For example, the user might
     define lists of integers and atoms as:

		list(integer() | atom())

Kostis



More information about the erlang-questions mailing list