this post was submitted on 08 Jun 2025
487 points (97.7% liked)

Programmer Humor

36300 readers
1187 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] jsomae@lemmy.ml 4 points 12 hours ago (1 children)

Lua might have been a better choice, since self is special in lua.

[–] diemartin@sh.itjust.works 1 points 8 hours ago (1 children)

Kinda.

Lua defines it implicitly only when you use the

function foo:bar(a, b, c) -- note the colon

syntactic sugar, which gets translated to

function foo.bar(self, a, b, c)` -- note the period

In all other cases, self is a regular variable name. You can even redeclare a new local with that name even when the old one is in scope.

[–] jsomae@lemmy.ml 1 points 6 hours ago

I don't see how what you said is inconsistent with me saying "self" is special in lua. Note that I did not say it's a keyword.