Hacker News new | ask | show | jobs
by dmz73 764 days ago
It seems that a lot of programmers have trouble distinguishing between indexing and offsets. This is probably due to legacy of C language which conflates those two, possibly for performance and simplicity reasons. Same goes for case sensitivity in programming languages, again a legacy of C...are Print, print and PRINT really different functions, is that really what you intended??? Anyway, indexing is enumerating elements and it naturally starts at 1 for the first element and goes to Count for the last. Offsets are pointer arithmetic artifact where first element is at offset of 0 for most but not all data structures. Then you get "modern" languages like Python where they adopt indexing from 0 (no offsets since there are no pointers) and range where start is inclusive and end is exclusive...very natural behavior there. Oh, and lets make it case sensitive so you never know if it's Print, print, PRINT...or count, Count and COUNT until you run for 20 min and then crash.
1 comments

I'm confused that you're bringing in case sensitivity into the discussion. For simplicity, early systems could not be case sensitive because they didn't have a large enough character set.

The comment about crashing due to spelling error really should be addressed by some form of static analysis, not by making name lookups more relaxed, in my opinion.