Re:Runtime verification in Erlang by using contracts
by fiddlerwoaroof on Wednesday February 06, 2019 @09:21PM
(#19102379)
I think in languages like Eiffel that have first-class support for DBC, there’s less noise because the language is designed to propagate contracts appropriately (e.g. making subclasses inherit contracts from their base classes.)
Also, there’s been a lot of work in the Racket community on contracts: I think it has something to do with making Racket/Typed Racket interop safe .
Re:Runtime verification in Erlang by using contracts
by macintux on Thursday February 07, 2019 @07:39AM
(#19104821)
It definitely seems like any OOPL would be inherently at a severe disadvantage in this style. In most Erlang code all you’d have to check are the function parameters.
One concern I have with their Erlang solution is that the preconditions and postconditions are expressed for the function as a whole, not each function clause. In some contexts, rather like OOP, a function can be quite different depending on the context it’s called with.
Re:Runtime verification in Erlang by using contracts
by throwawayjava on Wednesday February 06, 2019 @09:23PM
(#19102396)
There's a whole "paradigm" called "light weight verification". I could point to particular papers, but unfortunately I don't know of a good survey article or exemplar tool/implementation/framework. But the term is very google-able, and skimming papers/tool descriptions will quickly give you a general sense for what sort of things are possible.
Re:Runtime verification in Erlang by using contracts
by apaprocki on Wednesday February 06, 2019 @09:18PM
(#19102366)
Contracts were developed into the C++ standard to make this easier: https://en.cppreference.com/w/cpp/language/attributes/contra...
Is there any recent writings on this pattern on applying the idea more sanely? As it is, I think I prefer to write testing code outside of the core behavior and have to anticipate what values are valid, or create new tests as bugs are found.