[erlang-patches] Add spec for base64:encode_binary/1
Wed Aug 18 13:26:25 CEST 2010
Paul Oliver wrote:
> Dialyzer was reporting that use of base64:encode(Foo :: binary()) had spec
> binary() -> <<_:_*1>>. The binary comprehension in base64:encode seems to
> result in the return type of <<_:_*1>>. The patch below enforces a return
> type of binary().
Sorry, but I cannot understand your mail... Can you elaborate a bit?
First of all, dialyzer cannot be reporting what you are claiming because
the spec of base64:encode/1 is:
-spec encode(string() | binary()) -> binary().
You are probably referring to some other function...
Looking at your patch, it seems that it refers to base64:encode_binary/1
which is a *module-local* function, not an exported one. Why do you feel
the need to add a spec to this function? What exactly is it that changes
in your use case?
More information about the erlang-patches