[erlang-questions] Looking for tricky protocol examples for verification research
Wed Nov 5 19:24:43 CET 2014
On Fri, Oct 31, 2014 at 12:20 PM, zxq9 <> wrote:
> In a duck typed language like Python we can treat anything as some type if
> implements the basic methods expected of that type. An outside process
> need to care (sure we could introspect, but needing to is usually regarded
> 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
> AI for player control on the fly and the character process wouldn't care,
> long as all controllers, regardless of subtype (if we decide to use this
> "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
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...
More information about the erlang-questions