[erlang-questions] Why isn't erlang strongly typed?
Wed Nov 5 02:12:27 CET 2008
On 5 Nov 2008, at 12:33 pm, Isaac Gouy wrote:
>> Traits don't disallow access to state.
>> They disallow *direct* access to state.
>> They can use as much state as they want,
>> provided they do so by calling methods from the
>> class they are extending.
> In other words, traits disallow access to state and require methods in
> the class (not in the trait) for access to state :-)
Many Smalltalk masters recommend what's called "self-encapsulation"
where ANY class should encapsulate access to its state variables in
a small handful of methods and ALL other methods should use those
to access state rather that directly referring to instance variables.
Nobody says that this disallows access to state!
On the contrary, people talk about calling such accessor methods
as "access to [state] data". See
for an example of this usage.
Traits don't have any state of their own to access,
so they can hardly be said to disallow access to what does
not exist. For access to the state of the class they are
bound in with, traits rely on self-encapsulation, not as
a way of disallowing access to state, but as a way of
To call this extended use of self-encapsulation
"disallowing access to state" would be rather like calling
windows devices for disallowing access to light.
More information about the erlang-questions