Re: Some initial clarifications
- Posted by _tom (admin) Jan 16, 2019
- 1759 views
oE compared to Phix
Euphoria
The essential skill in learning oE or Phix is atom|sequence. There is no penalty in learning one language instead of the other.
Off-by-one
oE and Phix feature one-based indexing. Off-by-one indexing in a conventional language is costly in lost grey cells.
Actions
In oE and Euphoria actions apply by default and uniformly to atoms and sequences. In Phix this rigour is relaxed; you will get a warning message about sequence operations. This allows Phix to use an equality operator when oE requires an equality function. (A great convenience to novice and lazy programmers.)
Indexing
In oE indexing more conservative:
- only positive index values are allowed
- assignments will never create or destroy items in a sequence list
- assignment can only replace values of items
- functions are needed to create or destroy items in a sequence list
In Phix indexing is more convenient:
- positive integers index from left to right
- negative integers index from right to left
- assignment can be used to insert, replace, or destroy items in a sequence list
Phix will read oE indexed code but oE will not be able to read Phix indexed code.
Speed
Faster than conventional for sure. Maybe Phix is faster more often. Results can be skewed after compiling. Either choice is better than some popular language.
Parameters
Phix has "named parameters" that are more convenient than those in oE
Compiling
Phix does it all. oE needs an external C compiler
Functions
In Phix you can not "quietly" discard a value returned from a function. oE lets you discard function values the same as in many conventional languages.
Standard Library
- oE library is larger
- many oE routines can be used in Phix with no or minimal re-writing
- some oE library routines are heavily interdependent and not suitable for Phix
includes
Phix has an "auto include" feature that enables the most commonly used library routines. oE requires you to manually list include libraries.
regex
oE uses the standard PCRE engine. Phix uses a simplified regex engine.
IUP
- the IUP GUI is available for both oE and Phix
- Phix named parameters make gui writing simpler
euGTK
For oE and Linux (Not Phix). (GTK applications can be "made" to run on Windows.)
Threads
Phix has support for threads; oE does not.
Language Internals
Phix uses assembler code. oE uses C code; that implies porting oE may be easier.
string
Phix adds the string data-type which saves bytes for UTF8 encoded strings.
comparison
The Phix equality ` == ` operator compares any objects. The oE ` = ` equality operator only compares atoms; you must use equal) or compare) functions for mixed equality tests
?
Using ? for output in oE only shows numbers. Using ? for output in Phix will show strings as text, and numbers as numbers.
Novice
Phix permits ` := ` and ` = ` for assignments; saves explaining the difference between equality and assignment for absolute beginners. Phix allows ` ; ` as a spacer between statements.
Dual Code
You can do a few tricks to make code run on oE and Phix at the same time. This seems like a lot of work to me.
Include files are written in oE|Phix not C or assembler. That means you can read, understand, and adapt from one to another.
Conclusion
Phix indexing, autoinclude, `?` for output, no C dependence for compiling ... add up as great conveniences for someone starting in Euphoria programming.
For some projects euGTK and and the std/library favour choosing oE.
We still have programmers who use the original Euphoria!
_tom