The meaning of this
-
This post did not contain any content.
-
This post did not contain any content.
Yeah, this is that.
-
This post did not contain any content.
"We wanted it to work like Perl," said someone who should have been killed on the spot.
-
"We wanted it to work like Perl," said someone who should have been killed on the spot.
At the time JS was created, Perl didn't have a
this
. A lot of the docs and books suggested using$self
but a reference to the object would be passed as the first parameter to all class methods and you assign that to any name you wanted.It's only very recently (as in the last year or so) with a new
class
system that Perl has hard-coded$self
for that purpose. -
At the time JS was created, Perl didn't have a
this
. A lot of the docs and books suggested using$self
but a reference to the object would be passed as the first parameter to all class methods and you assign that to any name you wanted.It's only very recently (as in the last year or so) with a new
class
system that Perl has hard-coded$self
for that purpose.I mean
$_
. -
This post did not contain any content.
Go:
-
This post did not contain any content.
const that = this;
-
This post did not contain any content.
I did not know that about event handlers, that is actually super convenient
-
This post did not contain any content.
Rust: do you mean Self or self?
-
This post did not contain any content.
let self = this;
-
Rust: do you mean Self or self?
wrote on last edited by [email protected]this
is commonly used with a similar meaning toself
in cases whereself
can't be used because it is a reserved keyword.Example:
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<St1::Item>> { let this = self.project(); this.inner.poll_next(cx) }
https://github.com/rust-lang/futures-rs/blob/master/futures-util/src/stream/select.rs#L113-L116
-
This post did not contain any content.
Any language feature with such a long definition is a bad language feature.
The less such features, the better the language.
Thus, javascript is not a "good" language for expressing your programs.
-
This post did not contain any content.
In python self is just a convention, you can call it whatever you want
-
In python self is just a convention, you can call it whatever you want
and don’t ever pull the mask off by reading the descriptor and meta object protocol.