Live data from Hacker News

The Phix Programming Language

phix.x10.mx

41–46 of 46 posts

Re: The Phix Programming Language

#42
post #12

What 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…

> usage of resizable array-based vectors for all composite data types

Doesn’t this describe many of the modern languages - python’s lists, ruby’s arrays, etc...? Or is the cool part the lack of more specialized classes like dict or set?

Re: The Phix Programming Language

#43

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...

It depends on what you're trying to describe.

If you're trying to describe an offset from a starting position, then zero-indexing makes sense.

If you're trying to describe the rank/position of something in a list, then IMO one-indexing is not unreasonable.

Re: The Phix Programming Language

#44
post #42

Earlier quoted context omitted.

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…

> usage of resizable array-based vectors for all composite data types Doesn’t this describe many of the modern languages - python’s lists, ruby’s arrays, etc...? Or is the cool part the lack of more specialized classes like dict or set?

Python, actually, is older than Euphoria. :) The cool part is the focus on cache-local data structure first. Way more popular scripting languages like JS and Lua use hash tables as their primary data structures, Python and Ruby offer arrays as secondary option, but focus on using structs (classes) everywhere. Euphoria answer to this is to use arrays of cells for everything and enum your way out of situations where you need to group things.

Re: The Phix Programming Language

#45
post #30

Earlier quoted context omitted.

Shouldn't the tuple for 1-based indexing be 1,n,n ?

Yes, you're right. I think that slip says a lot about the tricky issue at hand. 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 th…

Having the last index and the length be the same may not be the good thing. for instance, if you translate python's negative indices (x[-i] = x[len(x)-i]) directly the last element would be...x[-0]? But then having the last element be x[-1] in python is also not entirely obvious.
Post reply on HN