I don't understand why anyone would create a one-indexed language these days. I feel like Dijkstra laid out pretty well why zero-indexing is objectively better [1]. If that wasn't enough, it's also most common by far. [1] https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/E...
The Phix Programming Language
31–40 of 46 posts
Re: The Phix Programming Language
#32I don't understand why anyone would create a one-indexed language these days. I feel like Dijkstra laid out pretty well why zero-indexing is objectively better [1]. If that wasn't enough, it's also most common by far. [1] https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/E...
Though I've grown up with programming languages that have zero-based indexing, I've never become a "native speaker", as I always mentally add or subtract a one as needed when trying to understand code involving list indices. Zero-based indexing may be common, but I'm pretty sure it's far from natural to most people. It is likely a main cause of many off-by-one bugs. I wouldn't blame a language designer for choosing o…
For me it's far more confusing when I have to write code in a language with 1-based indexing, although I can see why e.g. Julia does it as it's more focused on mathematics and also in some cases the indexing is actually simpler when specifying a range.
Re: The Phix Programming Language
#33Out of curiosity, what is the purpose of this language? A learning exercise or an attempt to create just another language in the pool of over 1000 already there? Writing an entire language as a way to hone someone's skills is great, even if it is very time consuming vs. the output (skills learned). But I wonder what better options exist.
Re: The Phix Programming Language
#34What I need to know about a language: Does it do static types? Does it depend on GC? Can I pass functions to functions? Can I build an aggregate by listing the members, and pass it around? Can I vary the implementation of a function according to the types passed, as determined at compile time? If your description just lists (howsoever appealing) platitudes, I don't get the answers I need.
Re: The Phix Programming Language
#35Earlier quoted context omitted.
You'll typically see it in computer algebra systems whose syntax is intended to be typeset as traditional mathematical notation. Mathematica, for example, wants an array to look like what's being typeset, and it would be confusing (moreso than the potential off-by-one errors) to display `x[3]` while the actual code said `x[2]`. I think other languages aimed at mathematicians, like Julia[1], do this for similar reason…
Shouldn't the tuple for 1-based indexing be 1,n,n ?
Re: The Phix Programming Language
#36Earlier quoted context omitted.
You'll typically see it in computer algebra systems whose syntax is intended to be typeset as traditional mathematical notation. Mathematica, for example, wants an array to look like what's being typeset, and it would be confusing (moreso than the potential off-by-one errors) to display `x[3]` while the actual code said `x[2]`. I think other languages aimed at mathematicians, like Julia[1], do this for similar reason…
Shouldn't the tuple for 1-based indexing be 1,n,n ?
First position, last position, and length for an array of [1, 2, 3].
0-based: 0, 2, 3 (0, n-1, n)
1-based: 1, 3, 3 (1, n, n)
Actually, that's a pretty convincing argument. I've played with Lua before, and did get the feeling that 1-based index has some advantages (but couldn't articulate why).Having the last position and the length be the same seems to fit the common intuition, like how children count: "What is the position of the last thing" and "How many things do we have?".
So it may make the language easier to learn. On the other hand, it may make the learner struggle to pick up most other languages which use 0-based index. I suppose it's been argued in depth on both sides..
Re: The Phix Programming Language
#37What I need to know about a language: Does it do static types? Does it depend on GC? Can I pass functions to functions? Can I build an aggregate by listing the members, and pass it around? Can I vary the implementation of a function according to the types passed, as determined at compile time? If your description just lists (howsoever appealing) platitudes, I don't get the answers I need.
It is dynamicly typed with optional validators built-in. The cool part (and also the main weakness) is usage of resizable array-based vectors for all composite data types. Other distinguishing traits are RC-based GC, no higher-order functions (but ability to pass function pointers), direct memory access via BASIC-like poke. Original Euphoria language wasn't a scripting one, more like C on steroids (for MS-DOS), and i…
Re: The Phix Programming Language
#38I don't understand why anyone would create a one-indexed language these days. I feel like Dijkstra laid out pretty well why zero-indexing is objectively better [1]. If that wasn't enough, it's also most common by far. [1] https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/E...
Zero-based indexing makes sense only in light of the underlying mechanics of memory address offsets (which, IIRC, isn’t even how eg C literally works). Natural numbers are counting numbers. It makes “more sense” that a sequence up to N contains N numbers, that is, its members can be put in a bijection with {1,...,N}
These are all conventions, of course. But the latter convention has a finer pedigree.
Re: The Phix Programming Language
#39Re: The Phix Programming Language
#40Ah, got it. You need to download the executable p64, see http://phix.x10.mx/download.php Like with old lisps.