[erlang-questions] Coming type checking in records :)

Kostis Sagonas <>
Sat Nov 24 19:08:34 CET 2007


Mickaël Rémond wrote:
> Hello,
> 
> It seems that type checking in Erlang record is coming soon :)

Not only in records, but also for functions.
Take a look at the -spec() declarations in kernel/src/file.erl too.

> In Erlang R12B snapshot (file.hrl):
> 
> -type(date() :: {pos_integer(), pos_integer(), pos_integer()}).
> -type(time() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}).
> -type(date_time() :: {date(), time()}).
> 
> %%--------------------------------------------------------------------------
> 
> -record(file_info,
> {size   :: non_neg_integer(), % Size of file in bytes.
> type   :: 'device' | 'directory' | 'other' | 'regular' | 'symlink',
> ...
> 
> 
> I guess the intend is to use this new information in dialyzer.

Well, that's not just intention -- it's reality in R12.

> Anyway, it looks nice :)

Merci beaucoup!

Kostis




More information about the erlang-questions mailing list