<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><meta http-equiv="Content-Type" content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Greetings,<br class=""><br class="">It is true that it is a matter of taste but remember that some Erlang containers can not be used to pattern match. Using one of those handle_call/3 would only be one function clause. And while maps can be pattern matched the compiler will not help you with spelling mistakes, as it does with records.<br class=""><br class=""><br class="">Best Wishes,<br class="">bengt<br class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 2 Jun 2019, at 13:25, Stefan Hellkvist <<a href="mailto:hellkvist@gmail.com" class="">hellkvist@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div dir="ltr" class=""><br class=""></div><blockquote type="cite" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><font face="courier new, monospace" class="">...<br class="">handle_call({run, Args}, _From, {Limit, Spv, Refs, Queue}) when N > 0 -><br class="">  {ok, Pid} = supervisor:start_child(Spv, Args),<br class="">  Ref = erlang:monitor(process, Pid),<br class="">  NewRefs = gb_sets:add(Ref, Refs),<br class="">  NewState = {Limit-1, Spv, NewRefs, Queue},<br class="">  {reply, {ok, Pid}, NewState};</font><br class=""></div><div class=""><br class=""></div><div class="">We also can use the above alternative code right?<br class=""></div></div></div></blockquote><div class=""><br class=""></div><div class="">Yes, you can use whatever Erlang term you prefer - record, tuple, map, a list of maps containing records of tuples...</div><div class=""><br class=""></div><div class="">What you choose is a matter of taste and depends on your requirements. A record for instance has the advantage over a tuple, that you access elements by name and the order of elements therefore becomes irrelevant. This could give advantages if you one day decide to add another field to your state. With the tuple approach this would likely break every access to the tuple everywhere in the code, but with a record where you access and match by names most of your code might still work...plus you never need to remember what meaning the third or fourth element in your tuple has l, because it has a descriptive name.</div><div class=""><br class=""></div><div class="">Stefan </div></div>_______________________________________________<br class="">erlang-questions mailing list<br class=""><a href="mailto:erlang-questions@erlang.org" class="">erlang-questions@erlang.org</a><br class=""><a href="http://erlang.org/mailman/listinfo/erlang-questions" class="">http://erlang.org/mailman/listinfo/erlang-questions</a><br class=""></div></blockquote></div><br class=""></div></body></html>