How to comm Between to erlang Modules .
Ingela Anderton
ingela@REDACTED
Fri Jul 26 12:38:21 CEST 2002
Well probably this is just a unhappy choice of word from your side (as
Lennart pointed out), but this seems to be a common misconception. So
I would like to press on the fact that you do not communicate between
two Erlang modules, however you may communicate between two Erlang
processes. I think the distinction between the two is very
significant. It is true that a single module may contain all the code
that a process runs but this is not always the case, and even when
this is the case there is a big difference. You may start many
process instances that are implemented by the same module. Lets say
the process code is defined by the module test and has a state
variable that tells you how many messages the process has
received. Consider the following:
1> ProcessA = test:start().
2> ProcessB = test:start().
3> ProcessA ! {self(), hello}.
4> ProcessB ! {self(), hello}.
5> ProcessB ! {self(), hello_again}.
Now ProcessA says that the state variable has the value 1 but ProcessB
say it has the value 2. This is as it should be. Now if a process
and a module where the same thing this would have been very odd, but
fortunatly they are not. Hope I made my point.
Good luck with your programming :)
sureshsaragadam@REDACTED wrote:
> Hai ,
>
> I am recently started working with erlang,
> How do i communicate between two erlang modules,
> please let me know if possible with example prg,
>
> thanking u.
>
> suresh
>
>
>
> ________________________________________________________________________
> Want to sell your car? advertise on Yahoo Autos Classifieds. It's Free!!
> visit http://in.autos.yahoo.com
--
/m.v.h Ingela
//The highway of life is always under construction. //
|\ _,,,--,,_ ,)
/,`.-'`' -, ;-;;'
|,4- ) )-,_ ) /\
'---''(_/--' (_/-'
Ericsson AB - OTP team
More information about the erlang-questions
mailing list