Live data from Hacker News

Pharen: A lisp that compiles to PHP

scriptor.github.com

31–40 of 43 posts

Re: Pharen: A lisp that compiles to PHP

#31
post #8
post #5

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.

Do you believe there are or will be good reasons to choose Pharen over Scheme, Common Lisp or Clojure in a situation where one isn't forced in to using a PHP backend? With Clojure, for example, I consider the baked-in concurrency models and data structures very valuable, but haven't had much cause to care that it runs on the JVM.

Re: Pharen: A lisp that compiles to PHP

#32
post #4
post #3

Earlier 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.

Is this is a problem you face personally?

Re: Pharen: A lisp that compiles to PHP

#34
post #14

Earlier 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.

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

#35

This 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?

Start here: http://scriptor.github.com/pharen/contribute.html

The project is on GitHub, so submitting patches is very easy.

Re: Pharen: A lisp that compiles to PHP

#37
post #34

Earlier 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.

I was curious to know the same thing. I do however like the code being side by side. It helps people who know PHP learn a little Lisp.

Re: Pharen: A lisp that compiles to PHP

#38
post #34

Earlier 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.

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.

Re: Pharen: A lisp that compiles to PHP

#39

From 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

>Is there a way to expand macros only and not do the compile-to-php step?

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

#40
post #34

Earlier 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.

Then again, you could argue that people interested in such projects like Pharen are likely to have modern PHP versions ;-)
Post reply on HN