3 ms·
I appreciate Dijkstra's arguments, but the fact remains that no non-technical user is ever going to jibe with a zero-indexed system, no matter the technical mer
by kibwen 2y ago
I appreciate Dijkstra's arguments, but the fact remains that no non-technical user is ever going to jibe with a zero-indexed system, no matter the technical merits.
Languages aimed at casual audiences (e.g. scripting languages like Lua) should maybe just provide two different ways of indexing into arrays: an `offset` method that's zero-indexed, and an `item` method that's one-indexed. Let users pick, in a way that's mildly less confusing than languages that let you override the behavior of the indexing operator (an operator which really doesn't particularly need to exist in a world where iterators are commonplace).
- School-Cotton 2y agoThere is no good reason to cater to non-technical users when designing programming languages. In what way is Lua “aimed at casual audiences”?
- pansa2 2y agoFrom Roberto Ierusalimschy himself [0]: "one of the design goals, was for Lua to be easy for nonprogrammers to use" [1] https://www.reddit.com/r/lua/comments/w8wgqb/complete_interview_with_roberto_ierusalimschy/ https://www.reddit.com/r/lua/comments/w8wgqb/complete_interv...
- kragen 2y agoA lot of Lua users are kids playing Luanti or Roblox or WoW who also spend a little time modding them—mostly editing textures or 3-D model meshes, but also scripting. Lua is a small and simple language which can be learned easily, prefers to produce incorrect answers instead of throwing exceptions when confronted with ambiguous situations (for example, permitting undeclared variables), has an interactive REPL, is memory-safe to avoid crashes, and uses dynamic typing (thus avoiding type declarations) and has garbage collection, as well as using 1-based indexing. All of these design features seem to be helpful to casual programmers and are common in languages and programming environments designed for them, such as BASIC, Smalltalk, sh, Python, Tcl, and Microsoft Excel. pansa2's comment https://news.ycombinator.com/item?id=43435736 https://news.ycombinator.com/item?id=43435736 also has a citation to Ierusalemschy, who said in https://old.reddit.com/r/lua/comments/w8wgqb/complete_interview_with_roberto_ierusalimschy/ https://old.reddit.com/r/lua/comments/w8wgqb/complete_interv...: > And at that time, the only other option would be Tcl, "tickle.” But we figured out that Tcl was not easy for nonprogrammers to use. And Lua, since the beginning, was designed for technical people, but not professional programmers only.In the beginning, the typical users of Lua, were civil engineers, geologists, people with some technical background, but not professional programmers. And "Tcl" was really, really difficult for a non-programmer. All those substitutions, all those notions, etc. So we decided to create a language because we actually needed it. (Tcl, of course, was designed for chip designers.)
- School-Cotton 2y agoOkay, fair enough. I stand corrected.
- kragen 2y agoI didn't intend to be correcting you. You weren't factually incorrect about anything; you just have different objectives than Lua's designers.
- School-Cotton 2y agoI mean, I was incorrect that Lua wasn't intended to be used by beginners/non-programmers.
- kragen 2y agoDijkstra's objective was to make programming into an intellectually respectable, rigorous branch of mathematics, a motivation he mentions obliquely here. He was, generally speaking, opposed to non-technical programmers and languages aimed at casual audiences, such as BASIC and APL; they were at best irrelevant to his goal and at worst (I suspect, though he never said) threats to its credibility.