Structs (was RE: Record selectors)

Mikael Karlsson mikael.karlsson@REDACTED
Fri Jan 17 18:51:24 CET 2003


Thursday 16 january 2003 23:28 Chris Pressey wrote:
> On Wed, 15 Jan 2003 09:18:38 +0100
.
> An example of this sort of 'use processes for *everything*' approach might
> be a project I want to try sometime this year, that is, to write a digital
> circuit simulator in Erlang.  Instead of messing with nasty physics
> equations, I think the problem could be modelled with one process per gate
> (or chip). Each chip process would receive a message every time one of
> it's pins changed state, so messages would essentially look like {N, M}
> where N is the pin number and M is either rising_edge or falling_edge.
> The process itself would take care of 'steady' state by tracking it every
> time a new message came in, and would also produce new messages to send to
> other chips wired to its output pins.
>
> Doing this with one process per truly concurrent unit should make it
> simple (almost trivial) to implement - but the thought of doing it this
> way with any language besides Erlang gives me shivers.

Maybe Timber, derived from O'Haskell could be worth looking at?

Erlang is really what I like for "production" code but I must confess that I 
do like the O'Haskell approach (were state is taken care of 
by object encapsulation, and records by Haskell typing, I think?  :)

http://www.cs.chalmers.se/~nordland/ohaskell/

O'Haskell is
the purely functional language Haskell, conservatively extended with:
- subtyping
- monadic objects

an object-oriented imperative language, enhanced with 
-parameteric polymorphism
-automatic type inference

a concurrent language, with 
-a reactive communication model
-asynchronous and synchronous message-passing

The author references both Erlang and Java in his thesis:
http://www.cs.chalmers.se/~nordland/ohaskell/thesis.ps.gz

I guess it is could be better to start with the the 4 page paper on Reactive 
Objects: http://www.cse.ogi.edu/~nordland/isorc.pdf

I can not judge how it compares with Erlang regarding concurrency model 
etc., but I think it would be interesting to get comments from any Erlang
linguist.

Regards
Mikael

PS Use the CVS version if you want to test the O'Hugs interpreter, it is much 
later than the tarball. DS




More information about the erlang-questions mailing list