programmer_humor·Programmer Humorbycm0002 The meaning of thisView original on lemmy.world306Comments9Reply
dd_k_bo replyfeddit.orgthis is commonly used with a similar meaning to self in cases where self 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-L1167Reply
vverstra programming.devAny 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.6Reply
HHomosexual sapiens lemmy.blahaj.zoneI did not know that about event handlers, that is actually super convenient2Reply
AAnotherPenguin programming.dev1Hide 1 replyIn python self is just a convention, you can call it whatever you want :)1Reply
9 replies
Go:
Yeah, this is that.
Rust: do you mean Self or self?
thisis commonly used with a similar meaning toselfin cases whereselfcan't be used because it is a reserved keyword.Example:
https://github.com/rust-lang/futures-rs/blob/master/futures-util/src/stream/select.rs#L113-L116
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.
I did not know that about event handlers, that is actually super convenient
In python self is just a convention, you can call it whatever you want :)