I am close to using a behaviour as a pure interface and I feel dirty...
Brett Hemes
brhemes@REDACTED
Wed Aug 25 00:13:08 CEST 2021
Brujo! Yes I read both of these (and your other stuff too) some time back and they have been (and still are) very helpful on my journey. I just watched the presentation earlier today coincidentally in my search and it confirmed most of what I have learned but still doesn’t tackle my deeper questions like (“am I doing something stupid to even arrive at this line of questioning?” and “why shouldn’t I have a delegate behaviour and/or one of just callbacks?”, etc.).
Thanks!
Brett
From: Fernando Benavides <elbrujohalcon@REDACTED>
Sent: Tuesday, August 24, 2021 4:54 PM
To: Brett Hemes <brhemes@REDACTED>
Cc: erlang-questions@REDACTED
Subject: [EXTERNAL] Re: Re: I am close to using a behaviour as a pure interface and I feel dirty...
I'm not entirely sure if this will help but a while back I wrote two articles and gave a talk about this subject. But I might have faced it from a different angle.
These are the links:
- https://youtu.be/OWCYD1Q0COQ
- https://medium.com/erlang-battleground/erlang-behaviors-4348e89351ff
- https://medium.com/erlang-battleground/erlang-behaviors-d5bb30d5412b
On Tue, 24 Aug 2021 at 23:47 Brett Hemes <brhemes@REDACTED<mailto:brhemes@REDACTED>> wrote:
> Erlang's behaviour is NOT an interface!
> If you are looking for some analogy from other languages the closest one is abstract classes in C#.
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.
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.
Aside: a colleague came across this repo (https://github.com/eldarko/epolymorph) while digging and the readme seems to capture my use case almost exactly...
Brett
--
Sent from Gmail Mobile by Brujo Benavides
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20210824/4673a739/attachment.htm>
More information about the erlang-questions
mailing list