Category:Phix: Difference between revisions
mNo edit summary |
m (search links have now fixed themselves) |
||
(31 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
|exec=both |
|exec=both |
||
|site=http://phix.x10.mx |
|site=http://phix.x10.mx |
||
|gc=yes |
|||
|gc=Reference Counting |
|||
|parampass= |
|parampass=both |
||
|express=explicit |
|express=explicit |
||
|checking=both |
|checking=both |
||
|tags=phix, Phix |
|tags=phix, Phix |
||
|altexec= |
|altexec=machine |
||
|hopl=no |
|hopl=no |
||
|LCT=yes |
|LCT=yes |
||
|bnf=http://phix.x10.mx/bnf.php |
|bnf=http://phix.x10.mx/bnf.php |
||
}} |
}} |
||
Phix is a self-hosted hybrid interpreter/compiler, developed by Pete Lomax. It is very easy to use, and similar to |
Phix is a self-hosted hybrid interpreter/compiler, developed by Pete Lomax. It is very easy to use, and similar to |
||
[https://rosettacode.org/wiki/Category:Euphoria Euphoria]. |
|||
On [https://rosettacode.org/wiki/Rosetta_Code/Rank_languages_by_popularity/Full_list?oldid=294533 26th December 2021, Phix became the first programming language on this site to have submissions for 100% of all tasks].<br> |
|||
⚫ | |||
(On 20th June 2022 [[Wren]] became the second, albeit with [https://www.rosettacode.org/wiki/Category:WrenGo 13]+[https://rosettacode.org/wiki/Special:Search?search=wren.h&wprov=acrw1_-1 66] of those embedded that I, for one, have been unable to run.) |
|||
⚫ | |||
You can also [https://replit.com/@PeteLomax1/PhixInterpreter#main.sh run Phix on replit here] (1.0.3 Lnx 64 bit), and several manually transpiled and uploaded entries [https://rosettacode.org/wiki/Category:Phix/online here] |
|||
Perhaps the most striking feature of Phix is that it has just five builtin data types: |
Perhaps the most striking feature of Phix is that it has just five builtin data types: |
||
Line 28: | Line 34: | ||
Phix applies the principle of least surprise, for instance in some languages <tt>myproc(list)</tt> or <tt>res = myfunc(list)</tt> can mangle list, whereas in Phix if you actually want that to happen you would code <tt>list = myproc(list)</tt> (and myproc would need to become a function) or <tt>{res,list} = myfunc(list)</tt>. Likewise 1/2 is 0.5 (not 0, unless you explicitly ask for the floor()) and 0-1 is -1 (not +MAXINT). A core tenet is that for any line of code there is one and only one possible interpretation of it, and said meaning is utterly intuitive. True fact: the given answer for the question "describe what f(a++) does" in "More Exceptional C++" lists 4 possibilities for f, and 3 for a (so 12 in total) and uses the phrase "could mean just about anything" not once but twice - shudder. |
Phix applies the principle of least surprise, for instance in some languages <tt>myproc(list)</tt> or <tt>res = myfunc(list)</tt> can mangle list, whereas in Phix if you actually want that to happen you would code <tt>list = myproc(list)</tt> (and myproc would need to become a function) or <tt>{res,list} = myfunc(list)</tt>. Likewise 1/2 is 0.5 (not 0, unless you explicitly ask for the floor()) and 0-1 is -1 (not +MAXINT). A core tenet is that for any line of code there is one and only one possible interpretation of it, and said meaning is utterly intuitive. True fact: the given answer for the question "describe what f(a++) does" in "More Exceptional C++" lists 4 possibilities for f, and 3 for a (so 12 in total) and uses the phrase "could mean just about anything" not once but twice - shudder. |
||
Phix |
Phix supports object orientation, but does not enforce it, and can achieve many of the claimed benefits in a much simpler way. In fact I have been looking for <i><b>proof</b></i> that object orientation actually improves productivity compared to other paradigms for decades, and never found it. One other thing I have never found is a "good object orientated design", and reached the conclusion that mythical creature simply does not exist, at least not as a separate entity as opposed to some ethereal quality of the finished code. Feel free to argue that one on [[User_talk:Petelomax]]. Phix offers perfectly decent encapsulation at the file level, proving that is not the sole purview of oo, implements polymorphism far more elegantly than C-based languages and far safer than duck-typed languages, and as for the third pillar of oop, inheritance, well isn't the current mantra "favour composition over inheritance"? |
||
Technically Phix does not have a garbage collector, instead it is reference counted, so memory is automatically reclaimed whenever a reference count drops to zero, and hence there are no sudden pauses, although the reference counting can itself reduce performance. |
|||
⚫ | The fundamental goal of Phix is to make debugging easier, a whole subject area that does not seem to get the attention it deserves, despite several studies finding that most programmers actually spend between 70 and 90% of their time debugging. Most of us tend to think that getting just-written code to work is somehow not debugging, but that clipboard-toting researcher stood behind you would disagree. |
||
Since 1.0.0 you can also run (many/most) Phix programs in a browser, by using pwa/p2js (as included in the distro) to transpile the program to JavaScript (plus a bit of standard HTML and CSS). If you see "'''with javascript_semantics'''" it means the program has been tested and works fine, both on the (Windows/Linux) desktop/Phix and in a browser via pwa/p2js, and in fact unix_dict() has been added to avoid reading unixdict.txt. Conversely, "without js" being present on a rosettacode entry means that (for instance) it uses the local file system, and is therefore desktop/Phix only. It is worth pointing out that "with js" and deep_copy() have proved ''staggeringly'' effective and nowhere near as painful as first feared. In just a few months (1.0.0 was released in July 2021) I have tested, fixed where necessary, and marked as javascript compatible ''[https://rosettacode.org/w/index.php?search=phixonline&title=Special%3ASearch&wprov=acrw1 over 1,200 rosettacode entries]'' for Phix, and only ''[https://rosettacode.org/w/index.php?search=notonline&title=Special%3ASearch&wprov=acrw1 one seventh]'' of that have as yet been marked incompatible, despite things like file i/o being prohibited within a web browser. The [https://rosettacode.org/wiki/Category:Phix/online Phix/online] subcategory currently lists 99 entries deemed interesting enough to bother (manually) uploading to the Phix website (ping me should any stop working), and the next goal is to get pwa/p2js itself runnning online, but obviously without using file i/o directly. Another long term goal is to get Phix running on ARM, and since that would be utterly pointless without a viable GUI, I am currently elbow deep in writing a new cross-platform GUI, as a stepping stone (for both ARM and p2js/online). |
|||
⚫ | The fundamental goal of Phix is to make debugging easier, a whole subject area that does not seem to get the attention it deserves, despite several studies finding that most programmers actually spend between 70 and 90% of their time debugging. |
||
==See also== |
==See also== |
||
* [http://phix.x10.mx Phix site] |
* [http://phix.x10.mx Phix site] |
||
* [https:// |
* [https://github.com/petelomax/Phix github] |
||
* [[Tasks_not_implemented_in_Phix]] |
|||
{{Language programming paradigm|Generic}} |
{{Language programming paradigm|Generic}} |
||
{{Language programming paradigm|Imperative}} |
{{Language programming paradigm|Imperative}} |
||
{{Language programming paradigm|Object-oriented}} |
Latest revision as of 21:53, 17 December 2023
This programming language may be used to instruct a computer to perform a task.
Official website |
---|
Execution method: | Interpreted or compiled |
---|---|
Garbage collected: | Yes |
Parameter passing methods: | By reference, By value |
Type expression: | Explicit |
Type checking: | Dynamic, Static |
Lang tag(s): | phix, Phix |
See Also: |
Phix is a self-hosted hybrid interpreter/compiler, developed by Pete Lomax. It is very easy to use, and similar to Euphoria.
On 26th December 2021, Phix became the first programming language on this site to have submissions for 100% of all tasks.
(On 20th June 2022 Wren became the second, albeit with 13+66 of those embedded that I, for one, have been unable to run.)
A simple 30MB download contains a pre-compiled executable, all the sources, and everything needed to recompile them, in under 20 seconds. The download also contains a full-featured programmer's editor and about 1000 demo programs.
You can also run Phix on replit here (1.0.3 Lnx 64 bit), and several manually transpiled and uploaded entries here
Perhaps the most striking feature of Phix is that it has just five builtin data types:
<-------- object ---------> | | +-atom +-sequence | | +-integer +-string
Despite such apparent simplicity, or perhaps precisely because of it, Phix programs are pretty fast - not quite achieving the runtime performance of C or assembly, but making up for it with a very fast edit/run cycle and proper human-readable messages should anything go wrong (even in shipped pre-compiled executables). Sequences are the real powerhouse of Phix. The one type covers lists, queues, tables, trees, and arrays, with strings being the subset that is array of character. They can grow and shrink automatically without any memory management overhead. For example if s="food" then s[2..3]="e" makes s "fed", and then s[2..1]="east" makes s "feasted".
Phix applies the principle of least surprise, for instance in some languages myproc(list) or res = myfunc(list) can mangle list, whereas in Phix if you actually want that to happen you would code list = myproc(list) (and myproc would need to become a function) or {res,list} = myfunc(list). Likewise 1/2 is 0.5 (not 0, unless you explicitly ask for the floor()) and 0-1 is -1 (not +MAXINT). A core tenet is that for any line of code there is one and only one possible interpretation of it, and said meaning is utterly intuitive. True fact: the given answer for the question "describe what f(a++) does" in "More Exceptional C++" lists 4 possibilities for f, and 3 for a (so 12 in total) and uses the phrase "could mean just about anything" not once but twice - shudder.
Phix supports object orientation, but does not enforce it, and can achieve many of the claimed benefits in a much simpler way. In fact I have been looking for proof that object orientation actually improves productivity compared to other paradigms for decades, and never found it. One other thing I have never found is a "good object orientated design", and reached the conclusion that mythical creature simply does not exist, at least not as a separate entity as opposed to some ethereal quality of the finished code. Feel free to argue that one on User_talk:Petelomax. Phix offers perfectly decent encapsulation at the file level, proving that is not the sole purview of oo, implements polymorphism far more elegantly than C-based languages and far safer than duck-typed languages, and as for the third pillar of oop, inheritance, well isn't the current mantra "favour composition over inheritance"?
Technically Phix does not have a garbage collector, instead it is reference counted, so memory is automatically reclaimed whenever a reference count drops to zero, and hence there are no sudden pauses, although the reference counting can itself reduce performance.
The fundamental goal of Phix is to make debugging easier, a whole subject area that does not seem to get the attention it deserves, despite several studies finding that most programmers actually spend between 70 and 90% of their time debugging. Most of us tend to think that getting just-written code to work is somehow not debugging, but that clipboard-toting researcher stood behind you would disagree.
Since 1.0.0 you can also run (many/most) Phix programs in a browser, by using pwa/p2js (as included in the distro) to transpile the program to JavaScript (plus a bit of standard HTML and CSS). If you see "with javascript_semantics" it means the program has been tested and works fine, both on the (Windows/Linux) desktop/Phix and in a browser via pwa/p2js, and in fact unix_dict() has been added to avoid reading unixdict.txt. Conversely, "without js" being present on a rosettacode entry means that (for instance) it uses the local file system, and is therefore desktop/Phix only. It is worth pointing out that "with js" and deep_copy() have proved staggeringly effective and nowhere near as painful as first feared. In just a few months (1.0.0 was released in July 2021) I have tested, fixed where necessary, and marked as javascript compatible over 1,200 rosettacode entries for Phix, and only one seventh of that have as yet been marked incompatible, despite things like file i/o being prohibited within a web browser. The Phix/online subcategory currently lists 99 entries deemed interesting enough to bother (manually) uploading to the Phix website (ping me should any stop working), and the next goal is to get pwa/p2js itself runnning online, but obviously without using file i/o directly. Another long term goal is to get Phix running on ARM, and since that would be utterly pointless without a viable GUI, I am currently elbow deep in writing a new cross-platform GUI, as a stepping stone (for both ARM and p2js/online).
See also
Subcategories
This category has the following 8 subcategories, out of 8 total.
@
- Phix User (6 P)
P
- Phix/basics (123 P)
- Phix/Class (23 P)
- Phix/libcurl (19 P)
- Phix/mpfr (72 P)
- Phix/online (100 P)
- Phix/pGUI (118 P)
- Phix/xpGUI (3 P)
Pages in category "Phix"
The following 200 pages are in this category, out of 1,677 total.
(previous page) (next page)L
M
- MAC vendor lookup
- Machine code
- Mad Libs
- Magic 8-ball
- Magic constant
- Magic numbers
- Magic squares of doubly even order
- Magic squares of odd order
- Magic squares of singly even order
- Magnanimous numbers
- Main step of GOST 28147-89
- Make a backup file
- Make directory path
- Man or boy test
- Mandelbrot set
- Map range
- Marching squares
- Markov chain text generator
- Mastermind
- Matrix chain multiplication
- Matrix digital rain
- Matrix multiplication
- Matrix transposition
- Matrix with two diagonals
- Matrix-exponentiation operator
- Maximum difference between adjacent elements of list
- Maximum triangle path sum
- Mayan calendar
- Mayan numerals
- Maze generation
- Maze solving
- McNuggets problem
- MD4
- MD5
- MD5/Implementation
- Median filter
- Meissel–Mertens constant
- Memory allocation
- Memory layout of a data structure
- Menu
- Merge and aggregate datasets
- Mersenne primes
- Mertens function
- Metallic ratios
- Metaprogramming
- Metered concurrency
- Metronome
- Mian-Chowla sequence
- Middle three digits
- Miller–Rabin primality test
- Mind boggling card trick
- Minesweeper game
- Minimal steps down to 1
- Minimum multiple of m where digital sum equals m
- Minimum number of cells after, before, above and below NxN squares
- Minimum numbers of three lists
- Minimum positive multiple in base 10 using only 0 and 1
- Minimum primes
- Minkowski question-mark function
- Modified random distribution
- Modular arithmetic
- Modular exponentiation
- Modular inverse
- Modulinos
- Monads/List monad
- Monads/Maybe monad
- Monads/Writer monad
- Monte Carlo methods
- Montgomery reduction
- Monty Hall problem
- Morpion solitaire
- Morse code
- Mosaic matrix
- Most frequent k chars distance
- Motzkin numbers
- Mouse position
- Move-to-front algorithm
- Multi-base primes
- Multi-dimensional array
- Multidimensional Newton-Raphson method
- Multifactorial
- Multiline shebang
- Multiple distinct objects
- Multiple regression
- Multiplication tables
- Multiplicative order
- Multiplicatively perfect numbers
- Multisplit
- Multiton
- Munchausen numbers
- Munching squares
- Musical scale
- Mutex
- Mutual recursion
- Möbius function
N
- N'th
- N-body problem
- N-grams
- N-queens minimum and knights and bishops
- N-queens problem
- N-smooth numbers
- Named parameters
- Names to numbers
- Naming conventions
- Narcissist
- Narcissistic decimal number
- Native shebang
- Natural sorting
- Nautical bell
- Negative base numbers
- Neighbour primes
- Nested function
- Nested templated data
- Next highest int from digits
- Next special primes
- Nice primes
- Nim game
- Nimber arithmetic
- Non-continuous subsequences
- Non-decimal radices/Convert
- Non-decimal radices/Input
- Non-decimal radices/Output
- Non-transitive dice
- Nonoblock
- Nonogram solver
- Nth root
- Null object
- Number names
- Number reversal game
- Number triplets game
- Numbers divisible by their individual digits, but not by the product of their digits.
- Numbers in base 10 that are palindromic in bases 2, 4, and 16
- Numbers in base-16 representation that cannot be written with decimal digits
- Numbers k such that the last letter of k is the same as the first letter of k+1
- Numbers which are not the sum of distinct squares
- Numbers which are the cube roots of the product of their proper divisors
- Numbers whose binary and ternary digit sums are prime
- Numbers whose count of divisors is prime
- Numbers with equal rises and falls
- Numbers with prime digits whose sum is 13
- Numbers with same digit set in base 10 and base 16
- Numeric error propagation
- Numeric separator syntax
- Numerical and alphabetical suffixes
- Numerical integration
- Numerical integration/Adaptive Simpson's method
- Numerical integration/Gauss-Legendre Quadrature
- NYSIIS
O
- O'Halloran numbers
- Object serialization
- Odd and square numbers
- Odd squarefree semiprimes
- Odd word problem
- Odd words
- Old lady swallowed a fly
- Old Russian measure of length
- OLE automation
- One of n lines in a file
- One-dimensional cellular automata
- One-time pad
- One-two primes
- OpenGL
- OpenGL pixel shader
- OpenGL/Utah teapot
- OpenWebNet password
- Operator precedence
- Optional parameters
- Orbital elements
- Order by pair comparisons
- Order disjoint list items
- Order two numerical lists
- Ordered partitions
- Ordered words
- Ormiston pairs
- Ormiston triples
- Overloaded operators
- Own digits power sum
- Execution method/Interpreted
- Execution method/Compiled
- Garbage collection/Yes
- Parameter passing/By reference
- Parameter passing/By value
- Typing/Expression/Explicit
- Typing/Checking/Dynamic
- Typing/Checking/Static
- Programming Languages
- Programming paradigm/Generic
- Programming paradigm/Imperative
- Programming paradigm/Object-oriented