<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
p.qt-msonormal1, li.qt-msonormal1, div.qt-msonormal1
{mso-style-name:qt-msonormal1;
margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle21
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Historically, have there ever been discussion of including stuff like this in the language itself?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Brett<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> erlang-questions <erlang-questions-bounces@erlang.org>
<b>On Behalf Of </b>Tristan Sloughter<br>
<b>Sent:</b> Wednesday, August 25, 2021 6:42 AM<br>
<b>To:</b> Erlang Questions <erlang-questions@erlang.org><br>
<b>Subject:</b> [EXTERNAL] Re: I am close to using a behaviour as a pure interface and I feel dirty...<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">I'll drop in this effort that was made years ago: <a href="https://github.com/erlware/erlware_commons/blob/master/doc/signatures.md">
https://github.com/erlware/erlware_commons/blob/master/doc/signatures.md</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">But I'm not saying I recommend it, I don't know that it is used much and I'd like to deprecate erlware_commons in the not too distant future (it is a dependency used by rebar3/relx and we want to remove as many of those as possible).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I'll also point out my use of behaviours to provide APIs for functionality (an Application Programming INTERFACE -- so "interface" isn't always an OOP construct). Hah, just realized I even called it an "interface" in my most recent PR
<a href="https://github.com/open-telemetry/opentelemetry-erlang/pull/269">https://github.com/open-telemetry/opentelemetry-erlang/pull/269</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">On Tue, Aug 24, 2021, at 15:46, Brett Hemes wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt;overflow-wrap:break-word" id="qt">
<div>
<p class="qt-msonormal1">> Erlang's behaviour is NOT an interface!<o:p></o:p></p>
<p class="qt-msonormal1">> If you are looking for some analogy from other languages the closest one is abstract classes in C#.<o:p></o:p></p>
<p class="qt-msonormal1"> <o:p></o:p></p>
<p class="qt-msonormal1">This isn’t very helpful... it is the exact same response I find in the forums with no reasoning behind it. I don’t need analogies either; I understand what behaviours are “supposed” to be from the documentation and comments (perhaps
this wasn’t made clear by my post). Where I fall short is “why” are behaviours limited to such and why aren’t more people asking the same questions I am stuck on (regarding polymorphism)? My logic was: yes, this has been asked and discussed some in the past
with no real resolution that I could find... therefore, users must be content/accepting of the tools provided. I am not so naive to think I am the first to need/want such, so there must be a disconnect.<o:p></o:p></p>
<p class="qt-msonormal1"> <o:p></o:p></p>
<p class="qt-msonormal1">I posted my example to motivate my questioning hoping for some insight and/or comfort. As of now, I have proceeded with storing “meta refs” to my child servers that are module/reference tuples (along with some dangerous and future-maintenance-issue-causing
assumptions regarding their “interface”)... and it’s works... it just smells, and I am always eager to learn and find the right/better/best way.<o:p></o:p></p>
<p class="qt-msonormal1"> <o:p></o:p></p>
<p class="qt-msonormal1">Aside: a colleague came across this repo (<a href="https://github.com/eldarko/epolymorph">https://github.com/eldarko/epolymorph</a>) while digging and the readme seems to capture my use case almost exactly...<o:p></o:p></p>
<p class="qt-msonormal1"> <o:p></o:p></p>
<p class="qt-msonormal1">Brett<o:p></o:p></p>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>