[erlang-questions] PropEr after test clean up

Kostis Sagonas kostis@REDACTED
Tue May 26 21:03:06 CEST 2015


On 05/26/2015 08:02 PM, Hynek Vychodil wrote:
> You just can't make simple and reliable clean up embedded in wrapper
> macro or function. You always have to make explicit ugly procedural code
>
> Objs = init(),
> run(),
> delete(Objs),
> test()
>
> You simply can't make nice clean functional or function like wrapper. It
> is ugly, repetitive, error-prone, procedural code. This is wrong.

I will not comment on the "ugly", "repetitive", "error-prone" and 
"wrong" characterizations.  As I wrote in my previous message these are 
not defined objectively.

However, please realize that the whole issue is about something which is 
not functional in the first place!  Under this prism, I am not very 
surprised you cannot, or at least find it difficult to, find a "clean 
functional" solution...  I would even argue that it is better this way. 
(I.e., that there is a "penalty" for wanting to test non-functional 
code.  If you find it disturbing, then simply write functional code.)

Kostis



More information about the erlang-questions mailing list