4 ms·
Lua: Good, bad, and ugly parts
- ANTSANTS 13y agoPrevious submission: https://news.ycombinator.com/item?id=5348513 https://news.ycombinator.com/item?id=5348513
- sillysaurus2 13y agoAlthough this has absolutely nothing to do with the submission, I followed a link from that thread, wound up at https://www.destroyallsoftware.com/talks/wat https://www.destroyallsoftware.com/talks/wat and laughed for about five minutes straight. Thanks!
- speeder 13y agoI am the one that should thank you for posting that link. I had a good laugh. And now I am curious about javascript crazy + behavior.
- TsiCClawOfLight 13y agoThank you so much for posting this! I've tried to find it again for ages! :D
- agumonkey 13y agoGary Bernhardt is regularly guilty of these things, checkout this other talk http://www.confreaks.com/videos/615-cascadiaruby2011-the-unix-chainsaw http://www.confreaks.com/videos/615-cascadiaruby2011-the-uni... both very interesting and very distracting, again.
- copx 13y ago>Good: Portable: builds on any platform with an ANSI C compiler. >Bad: No POSIX functions built-in. This is an either/or thing. You cannot implement those functions in portable ANSI C, it is platform-specific functionality. Also Lua is widely used on non-POSIX platforms (e.g. Windows) and given that the Lua developers have removed even most simple and basic functions like table.foreach in the past to keep the language minimal I don't see them ever adding those. Personally I like it this way.
- lvh 13y agoThere's a lot of great middle ground though; consider what Python does for many of those APIs :)
- Avshalom 13y agowell then you lose the smallness. That's also why the pattern matching isn't quite regexp and about half of 'the bad' adding features adds size.
- Arelius 13y agoAlso consider that Lua is widely used on many game consoles and embedded hardware, where even the basic functionality of many posix functions doesn't make sense.
- deleted 13y ago[deleted]
- forkandwait 13y agoI have a new meta-pet-peeve: people who are peeved by one-indexing. EDIT: I guess it went into his "differetn" category. Never mind.... Why is one-indexing at the top of his list of bad things, or even on a list of things that matter? It is like getting stuck on adjectives after the noun... My opinion, not widely shared here, is that 1-indexing is best for scripting and math languages where 1-indexing corresponds directly to the subscripts in the formulas. In Numpy etc, you have spend a lot of time converting those formulas by subtracting one all over the place, introducing bugs and making stuff less readable. The only reason to use zero index is when, like in C, you are calculating your distance from a memory boundary. Sorry for the rant.
- paulclinger 13y agoIt's in the "other" section; neither good nor bad in my opinion, just different from (some) other languages.
- Pxtl 13y agoDijsktra on zero-based indexing: http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EW... Obviously the differences are small and it's not worth obsessing over, but I do think that zero-based approach works better with array code that involves offsets... and that's not the exclusive province of manually managed memory - array-index math can happen for many reasons. Of course, one-based math is more intuitive to the layperson, which is obviously why it's the natural choice for Lua.
- endianswap 13y agoAnd for those who didn't see this on HN a couple of days ago, here's Guido van Rossum on zero-based indexing in Python: https://plus.google.com/115212051037621986145/posts/YTUxbXYZyfi https://plus.google.com/115212051037621986145/posts/YTUxbXYZ...
- anonymous 13y ago1-based indexing is insane. In the literal sense. I can kind of conceive of a mind that doesn't run away when introduced to a 1-based language. Some young, inexperienced mind which doesn't understand numbers yet. I cannot at all conceive what madman would actually like 1-based indexing. Their mind must operate on principles completely alien to the rest of us and should, preferably, not be allowed to write programs.