Back in the days of Danny Goodman, the object this
referred to the object that sent the message to a function, e.g.,
aSender.aFunction();
aFunction() {
theSender = this;
}
Now, with the concept of “binding”, one must (??) use:
aFunction.call(aSender);
for theSender = this
to work inside aFunction.
I think (??) I understand binding … what I don’t understand is why the older concept of a “message” being sent to an “object” doesn’t seem to work anymore?
I’m not so sure about the this keyword anymore. It’s much easier to just pass the needed information to as a function argument instead.
Paul
You’re right … but I am just trying to learn.
About sending a message to an object, would that be something like this?
var obj = {
doSomething: function (msg) {
// do something with msg
}
};
var message = "Message information";
obj.doSomething(message);
I am thinking:
aMsg.aFunction();
aFunction() {
theMsg = this;
}
anon56670668:
aMsg.aFunction();
At the moment, I am returning to your original idea to just use:
function f(msg)
A bunch more understandable, rather than using:
f.call(msg)
1 Like
system
Closed
October 8, 2021, 4:21am
7
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.