r/ProgrammerHumor • • 21d ago

Meme encapsulationByIntimidation

Post image
604 Upvotes

24 comments sorted by

View all comments

Show parent comment

121

u/oh-no-89498298 21d ago

48

u/AlwaysHopelesslyLost 21d ago

Follow up question. Why?

90

u/lllorrr 21d ago • Heartwarming

Because Javascript lacks proper private object fields. And sometimes programmers have a bright idea to use library internals from outside.

9

u/Megolas 21d ago

I mean, there are private fields in JS for years now. Probably these are used to sync with the devtools or to support ancient browsers 🤷‍♂️

11

u/Silly_Guidance_8871 20d ago • Regret

And yet, I still field issues where someone's using a browser that doesn't support the feature, and I'm being tasked to make it work.

2

u/Draconis_Firesworn 17d ago

yk i was seeing discussion on python __/name mangling and saw people complaing about problems that only happen when you try to access a private variable outside its class causing weird stuff in a way that only happens when you do the thing you are explicitly told not to, and wondering why this is such a common complaint. Ig this isn't unique to python

1

u/asato977424 13d ago

Python's double-underscore mangling avoids subclass name clashes; it isn't access control, so deliberate access still works.

1

u/Draconis_Firesworn 13d ago

you can, doesnt mean you should

34

u/artofthenunchaku 21d ago

It's just a tongue-in-cheek way to indicate that you really, probably shouldn't be touching that variable without a really good reason. There's a lot of variable naming like that in Meta codebases

28

u/failedsatan 21d ago

Follow up to the follow up. Why is React in Minecraft (especially Microsoft's native port)?

17

u/nomenMei 21d ago

Apparently HBUI stands for "Hummingbird User Interface"

So I'd guess it's being used to define the menus and stuff

2

u/jf8204 21d ago

I encountered at least one other React variable with this naming convention. Maybe someone has time to list all of them.

2

u/One-Celebration-3007 21d ago

__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?