[erlang-questions] Element Typing in Record Declarations?

Per Gustafsson per.gustafsson@REDACTED
Wed Feb 25 21:14:37 CET 2009


David Mercer wrote:
> Are there any plans to add bitstrings as a type?  Currently, these have to
> be defined as any(), since binary() implies that bit_size is a multiple of
> 8.
>
>   

You should be able to write:

<<_:_*1>> for a bitstring or more generally:
<<_:M, _:_*N>> for a bitsring consisting of M+X*N bits where M, X and N 
are non-negative integers.

Per

>> -----Original Message-----
>> From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-
>> bounces@REDACTED] On Behalf Of Kostis Sagonas
>> Sent: Tuesday, February 24, 2009 9:33 AM
>> To: erlang-questions@REDACTED
>> Subject: Re: [erlang-questions] Element Typing in Record Declarations?
>>
>> David Mercer wrote:
>>     
>>> I just noticed in dict.erl:
>>>
>>> ...
>>>
>>> It appears that Erlang supports type declarations in record
>>> declarations, but I could not find this syntax in the Erlang reference
>>> documentation.  Is there any documentation on this, and what effect it
>>> has on the system?
>>>       
>> The documentation on this is currently an EEP:
>>
>> 	http://www.erlang.org/eeps/eep-0008.html
>>
>> This type information is used by Dialyzer to detect discrepancies
>> between the declared types of record fields and their actual uses.
>>
>> Kostis
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>     
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>   




More information about the erlang-questions mailing list