[erlang-patches] [PATCH] Fix -spec for file:write_file/3

Niclas Axelsson <>
Mon Feb 14 15:15:21 CET 2011


On 02/14/2011 12:54 PM, Magnus Henoch wrote:
> Change type for second parameter from binary() to iodata(), since the
> function explicitly takes steps to accept lists as well as binaries.
> ---
>   lib/kernel/src/file.erl |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/lib/kernel/src/file.erl b/lib/kernel/src/file.erl
> index bc95359..a7a6e96 100644
> --- a/lib/kernel/src/file.erl
> +++ b/lib/kernel/src/file.erl
> @@ -240,7 +240,7 @@ write_file(Name, Bin) ->
>   %% when it is time to change file server protocol again.
>   %% Meanwhile, it is implemented here, slightly less efficient.
>
> --spec write_file(Name :: name(), Bin :: binary(), Modes :: [mode()]) ->
> +-spec write_file(Name :: name(), Bin :: iodata(), Modes :: [mode()]) ->
>   	'ok' | {'error', posix()}.
>
>   write_file(Name, Bin, ModeList) when is_list(ModeList) ->
>    
Thanks Magnus.

I've merged your patch into 'pu' but will move it to 'dev' within a 
couple of days.

Regards
Niclas Axelsson, Erlang/OTP


More information about the erlang-patches mailing list