Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Berp: An implementation of Python 3, that compiles to Haskell (haskell.org)
123 points by dons on May 30, 2010 | hide | past | favorite | 20 comments


At first I thought: Like every other "static Python to compiled language X translator" this one will only translate some static-enough subset of the language, at which point it's not Python. Interesting as usual, but mostly academic.

But then I started reading the source code, and the amount of python features supported with regression tests is impressive! (Especially for something coming from the Haskell community which is notoriously anti-automated-tests).

http://github.com/bjpop/berp/tree/master/test/regression/fea...

Especially cool is the fact that you can use callCC!


> anti-automated-tests

Ummm... the Haskell community invented QuickCheck and HPC, the limit case of automated testing tools...

* http://en.wikipedia.org/wiki/QuickCheck * http://projects.unsafeperformio.com/hpc/


It's true - Haskell people use a lot of testing, since it's pretty simple to do in that environment. However, compilers in my experience are extremely easy to test. You can start building your input at whatever stage of compiling you need, run a specific transformation phase on it and check the output. I'd risk the opinion that compiler is the easiest to test "advanced" piece of software. Because of that, I'd be more surprised by a compiler project without regression tests.


You're right that it's pretty easy to write the individual tests.

But on the whole, I disagree: in my experience, compilers for non-trivial languages have an extremely large surface area, especially when optimization is involved. Language features have the habit of interacting with each other in non-trivial ways, and the combinatorics can quickly get overwhelming.


"the Haskell community which is notoriously anti-automated-tests"

What? That surprises me. I thought all Haskellers loved QuickCheck.


If you're not familiar with QuickCheck, it's easy to get the impression that Haskellers aren't big fans of test suites because the type system catches so many bugs for which you would otherwise need a bunch of regression tests to find.


Could not find a 'motivations for berp' doc. Why/how is this useful?


Allows a Pythonista to implement something that compiles into fast code, while retaining a lot of the compiler-unfriendly capabilities of Python.


I imagine a future version will allow for easy Haskell-Python integration? Good for Python shops wishing to move on or expand their abilities?


A short tutorial, more interesting than the link's list of dependencies: http://wiki.github.com/bjpop/berp/using-berp


I was looking forward to trying it, but then I had a problem installing it. (That's on Linux 32bit)

  $ cabal -V
  cabal-install version 0.8.2
  using version 1.8.0.2 of the Cabal library 
  $ ghc -V
  The Glorious Glasgow Haskell Compilation System, version 6.12.1
  $ cabal install berp
  Resolving dependencies...
  cabal: cannot configure berp-0.0.1. It requires integer -any
  There is no available version of integer that satisfies -any
Does it work for anybody? Does anyone know how to solve this?


Edit the .cabal file and rename it to integer-gmp or try removing it (haven't tried it myself yet)


Thanks, this solved that problem. Unfortunately it fails to build array-0.2.0.0 and I'll just wait until it's compatible with more recent versions of the Haskell Platform.


Does it (and will it) support either of the following: frame introspection, proper tracebacks.


As an goal in and of itself, it seems like one would go "did it get rid of frame introspection?!" in a happy voice, rather than "does it support frame introspection?"

Maybe you wanted to ask, "does it run Twisted and/or Zope", which use frame introspection (sadly, so very sadly), but otherwise, yuck.


Due to a bug in GHC 6.12.x, compilation will consume more than 2 GB of memory. Details here:

http://hackage.haskell.org/trac/ghc/ticket/3972

GHC developers are on it. Please wait.


Don Stewart is now spamming Hacker News and reddit.com/r/coding, as well as /r/programming ...

Edit: modded down for what? The truth is he spams all these fora with irrelevant articles.


Modded down because it's not spam. He posts a metric fuck-tonne of Haskell links but only the ones that the community is interested in get voted up. That's how these sites work, so obviously some of us like some of the stuff he posts. If you don't like it mod it down or ignore it and move on. Go to the new posts and vote for things you are interested in.

If you must complain, you're unlikely to find much agreement here since people reading these comments are probably interested in the article.


Wow. Gee. Let's see. /r/coding (where the maintainer asked me to submit articles!)

http://www.reddit.com/r/coding

3 articles in 3 weeks, all of which above 75% positive.


For one, you were bashing Don Syme (the F# guy) before you edited your comment.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: