Phel: A language inspired by Clojure that compiles to PHP
phel-lang.org
phel-lang.org
Feel free to asked any questions about the project and I try to answer them.
> Why Phel?
> Phel is a result of my failed attempts to do functional programming in PHP. Basically I wanted:
> - A LISP-inspired
> - functional programming language
> - that runs on cheap hosting providers
> - and is easy to write and debug
I think in general, PHP's shared nothing architecture is a very good fit for functional programming. You get a HTTP Request and return a HTTP Response.
[1] https://phel-lang.org/blog/functional-programming-in-php/
So it is definitely nice to see other languages compiled to PHP to make use of the cheap shared hosts.
Do you implement persistent data structures? (totally cool if not, just curious)
Is Phel a subset/superset of Clojure? Perhaps a list of "differences from Clojure" vs "implemented features" would be useful for people looking at Phel.
But why those square brackets for argument lists? That seems unnecessary.
No, it's not a array, it's a vector.
And no it's not always defined as a vector, it's a particular trait of Clojure. In Common Lisp you'd use a list "(my arguments)" instead, for example.
The thing putting me off is both PHP and Clojure have mature/maturing tooling that I suspect would be unusable here
On the PHP side there's LSP servers, xdebug 3, PHPStorm (the only reliable client for xdebug I've found) xhprof, phan etc
On the Clojure side there's Cider, Cursive, Structural editing tools, Clj-kondo, Clojure-lsp
I love dynamic languages but I wouldn't use a new one without a few good static analysers and deep debuggers
[1]: https://www.php.net/manual/en/language.namespaces.rationale....
The widespread belief that compilation and interpretation are mutually exclusive is unfortunate, as is the artificial distinction between 'compiling' and 'transpiling' we sometimes hear, because these misconceptions show that programmers today are a bit confused about the essence of how programs actually run. It's a pity we don't have more cultural interest in such things, because mastering those notions can really improve software engineering.
(edit: to the GP's point, PHP does contain a compiler within it, because it translates source to bytecode as part of execution, but that's an implementation detail. As a product it is strictly an interpreter)