# Introduction

Phix has several advantages over other programming languages:

- A remarkably simple, yet flexible and powerful language definition that is easy to learn and use.
- A high-performance interpreter/compiler/transpiler much faster than most.
- Fully managed dynamic data storage with no requirement to allocate or free memory.
- Variables can grow or shrink to any size without any manual housekeeping.
- Extensive run-time checking for: out-of-bounds subscripts, uninitialized variables, bad parameter and variable assignments and many more. There are no mysterious machine exceptions -- you always get a full English description of any problem that occurs within your program at run-time, with the exact source line it occurs on, along with a full call-stack listing and a dump of all of your variable values. Programs can be debugged quickly, easily, and more thoroughly.
- A source level debugger allows execution of programs line-by-line. Tracing can begin (or end) on any line or for any condition, under full programmer control.
- A built-in execution profiler identifies which lines of code take up the highest percentage of execution time, or are executed the most often.
- Features of the underlying hardware are usually hidden. Programs are not typically aware of word-lengths, bit-representations, byte-order etc.
- However, Phix also satisfies anyone with a deeper curiosity. There is no hidden wall between the language and the operating system to fully understand how things actually work. Phix can create low-level listing files which show the exact addresses and assembly instructions generated, and also includes a program (filedump.exw) that shows every bit and byte in full detail (within reason, for example icons and other such data are shown in raw hex), for Windows PE, Linux ELF, and other format files.
- Self-hosted so there is no need to know another language, or obtain any other development tools, to enhance or fix the language itself. You can easily download, install, and recompile Phix in less than two minutes! (See the short webcast at http://phix.x10.mx/tutorial.php, and also Recommended Tools.)
- Standalone executables can be created simply by adding a "-c" flag to the normal interpret command (or via Ctrl F5 if using Edita). (The detailed assembly listing mentioned above is likewise just a "-d".) There are no complicated compiler options to remember and there is no separate linking phase. A simple format directive in the source allows for easy cross-compilation to any other supported system.
- Phix programs are naturally generic. The example program shows a single routine that will sort any type of data -- integers, floating-point numbers, strings etc. Phix achieves many of the benefits of object-oriented programming (which it has too, in an entirely optional fashion), yet in a much simpler way.
- Phix programs are naturally cross-platform, as long as you are not doing something obviously operating-system-specific such as reading the Windows registry, most programs should run unaltered on Windows, Linux, in a Web Browser [albeit not file i/o etc for the latter], and, hopefully soon, on a Raspberry Pi.
- It is not permitted to override builtins (at least not globally) or (re)define operators in Phix. While there are a few neat little tricks that sort of thing can achieve, the mental drain of always having to worry whether some builtin routine or operator is doing what you expect becomes significantly reduced, besides the superior and far friendlier compile-time and run-time error messages make modifying several files far less terrifying in Phix than it is in other programming languages.
- The Edita programmers editor is freely available, and written in Phix with everything you might expect, including multiple and user-definable syntax colouring, multilingual support, intellisense, autocompletion, code folding, integrated help, window painter, full source code, and more.
- Complete with around five hundred(!) demo programs, some of which are trivial learing aids and several dozen of which are production-quality full-blown GUI applications. Even with all that, it’s still only a 40MB download, with virtually no other dependencies [full disclosure: you almost certainly will want IUP on Linux, and maybe twenty-something of those demos do need some other bits ’n pieces installing].
- Backward compatibility statement: Largely since Phix is self-hosted, there is a very strong natural incentive for backward compatibility being maintained as long as realistically possible, and making any breaking changes produce clear no-nonsense messages that explain exactly what needs to be done when it cannot. Conversely the much more helpful than average error messages make it less terrifying to improve things for the better. The following lists all known breaking changes over the past eight years (for which I still have adequate records1, as of 2/4/24):
  2/4/24+: reverse() now only has one parameter.
  26/02/23: builtin constant E renamed as EULER (ie 2.71828182845904523536).
  26/02/23: permute() now in lexicographical order, prior ordering still available by setting bFast param to true.
  26/02/23: map:get() renamed as map_get().
  26/02/23: open_dll() and define_c_func/proc() now crash by default, set bCrash to false to restore legacy behaviour.
  4/7/21: sprint() asCh parameter added and maxlen displaced. Easily the worst offender on this list.
  23/5/20: allocatew() renamed to allocate_word().
  21/4/19: GetLastAccessTime() renamed as GetFileTime().
  1 Update: You might find a few more things down near the end of the readme.txt, which stretches even further back to 2010.
  In truth, I’ve (deliberately) broken at least five times that, but figured something non-breaking out before actually shipping.
  To review what else has been added in all that time, start here, and follow the links (on each #1) through to the previous twelve or so releases.