The Phix Programming Language

Published on 07 May 2021 (Updated: 18 April 2023)

Welcome to the Phix page! Here, you'll find a description of the language as well as a list of sample programs in that language.

This article was written by:

Description

According to the Phix Official Site, the aims of Phix are as follows:

Phix was created by Pete Lomax. Phix is largely based on Euphoria and is almost completely compatible with Euphoria. Pete has this to say as to why he created this language:

Phix was born out of frustration at waiting 18 months for a new release, only to find the problem was still there.

You may be wondering as to the reason for this name. According to the Phix Official Site:

Phix is Pete’s Self Hosted Hybrid Interpreter/Compiler. pshhic was not the best of acronyms, plus phiX is the name of the first ever manmade lifeform artifically created from scratch in a laboratory, which seems rather appropriate for a self-hosted compiler

Phix has the same four data types as Euphoria:

However, it adds a fifth data type:

Unlike Euphoria, Phix provides short-circuited ternary operators. For example, the iif function in Euphoria will evaluate both the true and false expressions and select the appropriate value. In other words, this code in Euphoria will call both foo and bar and then return the value to x depending upon whether x is non-zero or not:

integer foo_or_bar = iff(x, foo(), bar())

In Phix, this can be written like this:

integer foo_or_bar = iff(x ? foo() : bar())

Only if x is non-zero will foo be called; otherwise, bar will be called.

Here's a short summary of some of the other language features that Phix offers over Euphoria (just to name a few):

I'll have to admit, at first I just dismissed Phix as a knock-off of Euphoria, but after doing some more research, I have to admit this Phix is definitely worth further study!

If you'd like more information about this language, please see the Phix documentation.

Articles

There are 2 articles: