Hacker News new | ask | show | jobs
by ltratt 3628 days ago
Why Python and PHP? There are several reasons, but the major ones were: we had to start somewhere; we had an excellent Python interpreter available to us, as well as a fairly decent PHP interpreter; and PHP and Python turn out to be rather different languages with a number of tricky challenges. We certainly look forward to other people composing together even more distinct languages (e.g. we've also done a composition of Python and Prolog http://goo.gl/p1opSl, though, compared to PyHyp, it is rather simplistic).
2 comments

Wow. If you can combine Python and Prolog, I can't help but feel you can combine anything. Those are pretty different!
I'd love to see Python and R, the top two data analysis languages. Obviously this will only appeal to a subset of users, but language interoperability for data work is a hot issue right now.
Yeah I would love to see this too. Some differences:

- R has lazy evaluation semantics (with caveats), and Python is eagerly evaluated. The ggplot library in Python recently posted to HN sheds some light on these issues.

- R has like 2 or 3 class systems; Python has a C++-like class system (without static typing, but gaining it in Python 3)

- They differ in semantics with respect to closures (Python 3 changed things a bit)

- R's built-in types are all vectorized, but that might be a good thing, so you can use Python semantics for scalars and R semantics for vectors/data frames/matrices, etc ?

- Python has decorators, generators, coroutines, etc.

I tend to write my Python and R in a pretty small common subset, but yeah they are in fact quite different.

A crude R/Python composition would be fairly simple (http://goo.gl/p1opSl shows that a strict and lazy language can be crudely put together pretty easily, though you miss good performance and all the programmer-friendly features of PyHyp). Closures/generators are unlikely to be a big deal (PyHyp has good suggestions for both). Although I don't know much about R's class system(s), I expect that we can probably do OK on those. However, I have no idea how R's vectorised types might be handled -- those could be painful to deal with, or they might just fall out of the hat, and I'd have to know more about them in order to make an informed guess. However, this isn't on our roadmap at the moment, as it doesn't fit in with our current funding, unless anyone wants to change our minds!