[erlang-bugs] bug in erlang:size
Joe Armstrong
erlang@REDACTED
Sat Aug 4 18:26:03 CEST 2012
On Sat, Aug 4, 2012 at 8:29 AM, Kostis Sagonas <kostis@REDACTED> wrote:
> On 08/03/2012 11:12 AM, Joe Armstrong wrote:
>>
>> I think this is a bug:
>>
>> $erl
>> 1> B =<<1:17>>.
>> <<0,0,1:1>>
>> 2> size(B).
>>
>> 2
>>
>>
>> B is not a binary or tuple to size(B) should give badarg
>
>
> There is indeed something fishy in the above...
>
> But IMO, size/1 is one of these functions that should be considered
> deprecated and only kept for backwards compatibility. These days there
> exist built-in functions tuple_size/1, byte_size/1, and bit_size/1 that are
> unambiguous and more type-friendly.
>
> I would urge Joe to avoid mentioning the existence of size/1 in the new
> edition of his book.
Point taken - size will vanish
/Joe
> Kostis
>
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://erlang.org/mailman/listinfo/erlang-bugs
More information about the erlang-bugs
mailing list