this post was submitted on 12 Feb 2026
53 points (100.0% liked)

Programming

25504 readers
382 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS
top 10 comments
sorted by: hot top controversial new old
[–] FizzyOrange@programming.dev 2 points 2 hours ago

Experience has shown that having a map as your only data structure is definitely a mistake. It's much better to support real arrays too. I doubt it would have made the implementation significantly more complex either (maybe even simpler for luajit).

[–] lime@feddit.nu 19 points 1 day ago (1 children)

i think the most interesting design detail of lua tables is just glossed over as "nil-holes" in this article. namely, that nil values do not exist. there is no table.delete(key) method, you just zero out the value and the key stops existing. the same thing is true for any variable, if you set it to nil it ceases to be. i find that implementation fascinating.

[–] SlurpingPus@lemmy.world 4 points 12 hours ago* (last edited 6 hours ago) (1 children)

Except it's ass if you want to do non-destructive data processing of arbitrary structures and your input and output might have null as a value. You can't just know about fields a, b, and c of the table and leave everything else as it is, you need to know the whole structure and make sure you write null in the output for fields that have nil in them.

Or, more realistically, use libraries that implement null as custom user data.

Iirc Roberto Ierusalimschy even considered introducing a null value in one of the recent versions, of course confusingly named ‘undefined’ — but changed his mind. Perhaps it's for the better than to have such a backwards name for it.

To my knowledge, Lisps like Emacs Lisp implement this better: trying to get a value for a nonexistent key will get you nil, but you can still retrieve the list of all keys, including ones that are set to nil.

[–] lime@feddit.nu 1 points 2 hours ago (1 children)

yeah that's probably when you should drop down to C.

[–] SlurpingPus@lemmy.world 1 points 11 minutes ago

Eh, dkjson implements null as an object with a metatable function that encodes it back as "null". Hopefully it's considered equal to itself in comparisons.

Dkjson is fast enough for most scripting purposes. OTOH cjson's userdata null is supported by some other libraries that deal with data structures.

Of course, there's a problem then that various libs may have their own nulls, not equal to each other. There's even a lib that tries to marry some of them.

[–] puckpuckpuckow@lemmy.world 8 points 1 day ago (3 children)

Such a strange website. Pretty decent content, but just lying around as HTML/js/css files without a coherent layout to tie them all together? Reminds me of good ol' internet.

[–] matsdis@piefed.social 8 points 1 day ago

Yes, I like it. It makes only one (big) mistake: a horizontal table-of-contents. Nobody does that. You can put it on the left, or above the text, but... not like that.

[–] protogen420@lemmy.blahaj.zone 4 points 1 day ago (1 children)

wdym coherent layout? this thing looks more coherent than any reactwebbloatapp i have seen

it is also very mobile friendly, no lag while scrolling because react is being the bloated garbage it is

[–] puckpuckpuckow@lemmy.world 2 points 13 hours ago

I mean overall website, not the page itself. The page is super, but if you fiddle with the url a bit, the site has more nice content. But each page is different and seemingly don’t connect from other pages.

[–] somegeek@programming.dev 1 points 1 day ago

Good HTML is coherent by itself. Depends on if the html is good or not.