[eeps] Proposal for -type_assert

Michael Truog mjtruog@REDACTED
Mon Jul 14 22:49:38 CEST 2014


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 this?

Thanks,
Michael




More information about the eeps mailing list