Information hiding in Erlang
Fri Apr 28 04:54:02 CEST 2000
true information hiding in Erlang may be accomplished through the use
of processes. Information to be hidden is held in the process and the
process is acted on by messages, changing the state of the process.
Note: to be polite, you should also provide accessor functions which
format the messages correctly
This structure is typically used where state stores are required or segments
of a system need to be isolated from potentially misbehaving components.
In general, however, there is little value in concerning oneself about
users deliberately misusing a function, they can only hurt themselves by
killing their own process. Any nervousness about interfering with the
`hidden' inputs to a function are equivalent to worrying about someone
either forgetting to allocate an object or deleting and reallocating an
object in an OO program.
Processes should either protect their interfaces by either guards or
selecting only valid data types; or they should have a restart strategy
incase of failure.
More information about the erlang-questions