[erlang-bugs] illegal declaration of pertially defined record types in dialyzer, R14A

Nico Kruber <>
Tue Sep 28 11:24:22 CEST 2010


On Monday 13 September 2010 10:37:01 Vincent de Phily wrote:
> On Tuesday 31 August 2010 16:03:38 Nico Kruber wrote:
> > The type I use now is defined opaque but every method in the according
> > module gets well-formed records, i.e. no 'undefined' fields. I cannot
> > provide useful initialisers though because we store pids, for example.
> > We not have to distinguish well-formed records and those that may be
> > partially undefined and the given declaration would solve this problem.
> 
> What I do in those cases is to set a throw()n value as the default value.
> It's not 100% satisfying but it solves a few problems :
> 
> 
> -define(required(Record, Field), throw({record_field_required, Record,
> Field, ?MODULE})).
> 
> -record(file, {size = ?required(file, size) :: integer()}).

thanks, this helped a lot to work around that bug (and also saves some code-
duplication)


Nico
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20100928/3f06d79e/attachment.bin>


More information about the erlang-bugs mailing list