[eeps] Proposal for -type_assert

Siraaj Khandkar siraaj@REDACTED
Mon Jul 14 23:32:59 CEST 2014


Correct me if I misunderstand you, but it sounds like you're pointing to
the fact that success typing can only analyze the success of something
that has been called, so an interface of a library module would not be
analyzed on its own, but only as part of some other code that uses it
(and only the used functions at that). Yes?

Calling those library functions by some private functions is called
testing and there's nothing dirty about it :)


On 07/14/2014 04:49 PM, Michael Truog wrote:
> I am wondering if there is any support for adding a simple type
> assertion to the Erlang syntax.  The statement would be with
> "-type_assert" and it would have the same syntax as "-type" but would be
> asserting the developer's assumption of what the type should be.  I am
> finding this functionality necessary outside of normal -spec usage
> (which can help to provide some assertions when used with dialyzer)
> because of generic source code making assumptions that are only
> eventually required at lower layers, later in the execution during
> runtime, not during the initialization, which means that I can not
> easily put the assertion into a -spec unless I use functions that are
> private and not called (a dirty trick).  The "-type_assert" would be
> able to catch type errors at compile time which also helps to eliminate
> problems earlier on, avoiding the longer execution time required for
> dialyzer to process everything, so this also helps to speed up normal
> development tasks.  Any thoughts on th
> is?
>



More information about the eeps mailing list