Is the intended user a Lisp programmer forced to work on a php code base...or a Lisp programmer looking to take advantage of some of php's native server scripting features?
Both really, since interop with PHP is pretty easy so you can use those native features in a lispy way.
Pharen: A lisp that compiles to PHP
31–40 of 43 posts
Re: Pharen: A lisp that compiles to PHP
#32Earlier quoted context omitted.
What is it for?
Originally, for fun! It gives you a chance to use Lisp's syntax and mentality if you're stuck with PHP on the backend. Moreover, you have features like macros and lexical scope, which can be useful.
Re: Pharen: A lisp that compiles to PHP
#33Re: Pharen: A lisp that compiles to PHP
#34Earlier quoted context omitted.
Does this only work on the newest version of PHP? Compilation of closures, I presume, requires that PHP support closures, right?
Nope, it should work for PHP 5.2 as well. Closures are implemented using a static member on a class that handles all the lexically scoped variables, not PHP 5.3's native closures.
Other than that, Pharen looks very interesting. A minor detail is that I didn't yet figure out how to call static methods of external PHP classes.
Re: Pharen: A lisp that compiles to PHP
#35This is great. I just started on a lisp to php system a couple weeks ago - for many of the same reasons you did. How can I help with this?
The project is on GitHub, so submitting patches is very easy.
Re: Pharen: A lisp that compiles to PHP
#36Re: Pharen: A lisp that compiles to PHP
#37Earlier quoted context omitted.
Nope, it should work for PHP 5.2 as well. Closures are implemented using a static member on a class that handles all the lexically scoped variables, not PHP 5.3's native closures.
This makes me curious, why reimplement features that would've been built-in in PHP 5.3? After all, 5.3 is now available in most major platforms including a Ubuntu LTS release and the latest RHEL. Other than that, Pharen looks very interesting. A minor detail is that I didn't yet figure out how to call static methods of external PHP classes.
Re: Pharen: A lisp that compiles to PHP
#38Earlier quoted context omitted.
Nope, it should work for PHP 5.2 as well. Closures are implemented using a static member on a class that handles all the lexically scoped variables, not PHP 5.3's native closures.
This makes me curious, why reimplement features that would've been built-in in PHP 5.3? After all, 5.3 is now available in most major platforms including a Ubuntu LTS release and the latest RHEL. Other than that, Pharen looks very interesting. A minor detail is that I didn't yet figure out how to call static methods of external PHP classes.
Re: Pharen: A lisp that compiles to PHP
#39From reading the examples this looks awesome, I'll give it a try tomorrow at the office. Is there a way to expand macros only and not do the compile-to-php step? My current project involves generating php from a declarative definition and this could be just the right tool for the job! Maybe it will make switching to common lisp a lot easier once I learned enough of it :D
So that it would just generate the Pharen code resulting from the expansion? Unfortunately, not yet. As soon as a macro is done executing it returns the node tree itself, which is then compiled. There might be a way to hack macro-expand in though.
Let me know how trying to work it into your project goes! I'll be glad to help with any problems that come up.
Re: Pharen: A lisp that compiles to PHP
#40Earlier quoted context omitted.
This makes me curious, why reimplement features that would've been built-in in PHP 5.3? After all, 5.3 is now available in most major platforms including a Ubuntu LTS release and the latest RHEL. Other than that, Pharen looks very interesting. A minor detail is that I didn't yet figure out how to call static methods of external PHP classes.
I guess I wasn't exactly sure just how widespread PHP 5.3 was and wanted to play it safe. Also, even if new servers nowadays come with 5.3, a lot of existing code is still running on 5.2.