[erlang-patches] [PATCH] Fix lists:foreach/2's documented spec

Tuncer Ayaz tuncer.ayaz@REDACTED
Mon Oct 11 14:30:19 CEST 2010


2010/10/11 Björn Gustavsson:
> On Sun, Oct 10, 2010 at 7:02 PM, Tuncer Ayaz wrote:
>> ---
>>  lib/stdlib/doc/src/lists.xml |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/stdlib/doc/src/lists.xml b/lib/stdlib/doc/src/lists.xml
>> index 92c4eb4..0cf88fe 100644
>> --- a/lib/stdlib/doc/src/lists.xml
>> +++ b/lib/stdlib/doc/src/lists.xml
>> @@ -297,10 +297,10 @@ flatmap(Fun, List1) ->
>>       </desc>
>>     </func>
>>     <func>
>> -      <name>foreach(Fun, List) -> void()</name>
>> +      <name>foreach(Fun, List) -> ok</name>
>>       <fsummary>Apply a function to each element of a list</fsummary>
>>       <type>
>> -        <v>Fun = fun(Elem) -> void()</v>
>> +        <v>Fun = fun(Elem) -> term()</v>
>>         <v> Elem = term()</v>
>>         <v>List = [term()]</v>
>>       </type>
>>
>
> void() is a convention used in the documentation to mean
> that the function has no useful return value and should be
> ignored. It is used in many places in the documentation.

Both changes or only the 2nd (fun(Elem)) changed line?

> Try:
>
> git grep 'void()' | grep '[.]xml'

Is it wrong to rely on foreach/2 returning 'ok' even though the
spec in the sources specifies that?


More information about the erlang-patches mailing list