cm0002@lemmy.zip to Programmer Humor@programming.dev · 3 days agoMore code = more betterlemmy.zipimagemessage-square91fedilinkarrow-up1634arrow-down115
arrow-up1619arrow-down1imageMore code = more betterlemmy.zipcm0002@lemmy.zip to Programmer Humor@programming.dev · 3 days agomessage-square91fedilink
minus-squareedinbruh@feddit.itlinkfedilinkEnglisharrow-up1·21 hours agoPlease don’t do that, I was stupid when I wrote that. But still, in very dynamic languages like python or js everything is an object, including functions, so you can just do object stuff on them.
minus-squaresquaresinger@lemmy.worldlinkfedilinkarrow-up1·13 hours agoI wasn’t going to, and after I saw it it totally makes sense that it’s possible, it just never occurred to me. I guess this could be used like static variables inside functions in c. So scope-limited global variables. Not a good design choice in most cases.
Please don’t do that, I was stupid when I wrote that. But still, in very dynamic languages like python or js everything is an object, including functions, so you can just do object stuff on them.
I wasn’t going to, and after I saw it it totally makes sense that it’s possible, it just never occurred to me.
I guess this could be used like static variables inside functions in c. So scope-limited global variables. Not a good design choice in most cases.