[erlang-questions] Looking for tricky protocol examples for verification research

Jonathan Schuster schuster@REDACTED
Wed Nov 5 19:24:43 CET 2014


On Fri, Oct 31, 2014 at 12:20 PM, zxq9 <zxq9@REDACTED> wrote:

> In a duck typed language like Python we can treat anything as some type if
> it
> implements the basic methods expected of that type. An outside process
> doesn't
> need to care (sure we could introspect, but needing to is usually regarded
> as
> a sign of using the wrong tool).
>
> Erlang processes can be thought of the same way if we accept that in Erlang
> "process" means something much closer to what languages like Python mean by
> "object" than is commonly imagined. If I have a game character process it
> might have an AI controller, or it might have a player controller. The
> character process doesn't need to know or care, and we could actively swap
> out
> AI for player control on the fly and the character process wouldn't care,
> so
> long as all controllers, regardless of subtype (if we decide to use this
> term
> "type"), adhere to the "controller" protocol.
>

Yes, this is exactly the sort of abstraction I'm looking for. The main
questions I have right now are (1) where are the real-life examples of such
protocols, and (2) what is the most useful enforcement mechanism? A type
system would probably be the most familiar to programmers, but it's not
necessarily the most practical. Question 2 is really a research question,
and the answer to question 1 should help me solve question 2.

I haven't had a chance yet to look into the examples already mentioned on
this thread, but hopefully there are examples there or in other programs
I'm examining (e.g. ejabberd probably has several instances of this kind of
problem).

I agree that behaviors might be a good place to look. This does seem to be
the closest thing Erlang has to built-in protocol specifications, so maybe
I can extend those in an interesting way.

Sorry for the late response; been a busy few days.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20141105/9835624c/attachment.htm>


More information about the erlang-questions mailing list