[erlang-questions] Erlang "object-oriented" after all?
Richard O'Keefe
ok@REDACTED
Tue Nov 24 23:01:51 CET 2009
On Nov 24, 2009, at 10:06 PM, Joe Armstrong wrote:
> One problem with saying "everything is an object" is that it doesn't
> allow us to talk about things which are not
> objects. So ask questions like "is time an object?" is "code
> replacement an object?" is "is scalability an object?"
> you won't get a sensible reply.
But "everything is an object" doesn't mean that.
It means that "whatever can be the value of a variable is an object".
If "time" or "code replacement" or "scalability" could be the value
of a variable in some language, then it would make sense, in that
language, to ask if they were objects, but not otherwise.
In Smalltalk, for example, when you look at
2 squared
+ 2 is an object
+ #squared is an object
+ "tell somebody to square itself" is an object
+ the source code for Integer>>squared is an object
+ the history of changes to that source code is an object
+ the executable code for Integer>>squared is an object
+ the compiler is an object and can be asked to install new code
+ the execution context when the method runs is an object
- but "execution" per se cannot be the value of a variable
and is not an object and "compiling" and "installing" are not
objects. They are processes in time that take place when
certain objects are asked to do certain things.
>
>
> The erlang answers are easier:
>
> "Q: What is code replacement?"
> "A: A protocol - Pid ! {newCode, F} tells the process Pid to start
> executing new code F"
>
> and so on....
That "A" is the wrong category to be an answer to that "Q".
"A" answers
Q': How do I make code replacement happen?
A : A protocol - Pid ! {newCode, F} tells the process Pid to
start executing new code F
% but almost no processes understand that protocol
More information about the erlang-questions
mailing list