<div dir="ltr">There is commit showing how ugly is resulting code <a href="https://github.com/pichi/erlgt/commit/47aa088658ca6ca1e39e9630cd188f46e685e27a">https://github.com/pichi/erlgt/commit/47aa088658ca6ca1e39e9630cd188f46e685e27a</a><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 25, 2015 at 6:40 PM, Hynek Vychodil <span dir="ltr"><<a href="mailto:vychodil.hynek@gmail.com" target="_blank">vychodil.hynek@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">It is exactly how I discovered this behaviour. See <a href="https://github.com/pichi/erlgt/blob/ff3249893464f19765c74db2eae24273f15f66fd/src/gen_digraph.erl#L153" target="_blank">https://github.com/pichi/erlgt/blob/ff3249893464f19765c74db2eae24273f15f66fd/src/gen_digraph.erl#L153</a><br><div><br></div><div>When I implemented otp_digraph as a wrapper for digraph module from stdlib I realised it doesn't work.</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 25, 2015 at 6:34 PM, Erik Søe Sørensen <span dir="ltr"><<a href="mailto:eriksoe@gmail.com" target="_blank">eriksoe@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Would a try...after...end be any help?</p>
<div class="gmail_quote"><div><div>Den 25/05/2015 17.11 skrev "Hynek Vychodil" <<a href="mailto:vychodil.hynek@gmail.com" target="_blank">vychodil.hynek@gmail.com</a>>:<br type="attribution"></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Hi,<div><br></div><div>I bumped in the problem how clean up after property in PropEr. Let's have simple property where I make ets table:</div><div><br></div><div>prop_ets() -></div><div> ?FORALL(V, integer(),</div><div> begin</div><div> E = ets:new(),</div><div> true = ets:insert(T, {V, ok}),</div><div> equals([{V, ok}], ets:lookup(T, V))</div><div> end</div><div> ).</div><div><br></div><div>How am I supposed to delete ets table? It is trickier than looks like. The problem is when I want use another ?FORALL inside my property. The conjunction/1 is the same problem. You can`t write</div><div><br></div><div><div>prop_ets() -></div><div> ?FORALL(V, integer(),</div><div> begin</div><div> E = ets:new(),</div><div> true = ets:insert(T, {V, ok}),</div><div> Res = conjunction([{lookup, equals([{V, ok}], ets:lookup(T, V))},</div><div> {lookup_element, equals(ok, ets:lookup_element(T, V, 2))}]),</div><div> ets:delete(T),</div><div> Res</div><div> end</div><div> ).</div></div><div><br></div><div>Because Res is test(). In this case, you can make calls to the ets:lookup/2 and the ets:lookup_element/3 before conjunction/1 but it doesn't solve properties like</div><div><br></div><div>?FORALL(L, list(...),</div><div> begin</div><div> T = ets:new(),</div><div> ...</div><div> ?FORALL(V, oneof(L),</div><div> ...</div><div> )</div><div> end</div><div>)</div><div><br></div><div>The solution would be simple is every test case would be run in a separate process, but it is not! It is very unusual in Erlang word to make such thing. Processes are cheap and I can they are in a defined state each run for free. Why is it all running in the same process?</div><div><br></div><div>Has anybody solved this problem somehouw?</div><div><br></div><div>Hynek Vychodil</div></div>
<br></div></div>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>