On Fri, Feb 17, 2012 at 4:11 PM, Timothy Baldridge <[email protected]>wrote:
> > A more generally targeted question, besides the sample rpython tutorial > for > > brainfuck, what are the recommended readings (parts of the pypy code, > > papers, etc), tools and/or magic for working at rpython on an > interpreter? > > > Now, most of this code is more or less crap, but I do suggest taking a > look at my first stab at a RPython interpreter for Clojure > > https://github.com/halgari/clj-pypy > > > IIRC, the target complied okay, and you could run the code in > scratchspace.clj. > > Basically I got to the point where I realized that if I had lisp > macros, I could write RPython code way faster. Half of the structures > in Clojure follow this pattern: > > class Foo(object): > def __init__(self, foo bar, baz): > self.foo = foo > self.bar = bar > self.baz = baz > def addBarBaz(self): > return bar + baz > > I could write that for that, or, in Clojure I could write myself a > macro and just do: > > (deftype Foo [foo bar baz] > (addBarBaz[self] (+ bar baz))) > > So basically I've found that I can write the same code in the > following languages with this line ratio: > > Clojure: 1 > Python: 3 > Java: 6 > > This is the reason I shelved the RPython idea. If I want to > dramatically re-define how types are handled in Clojure-py all I have > to do is re-write a single macro. > > > <over generalization> > > "Why write a jit when you can have RPython do it for you?" > > "Why write a typesystem, when you can have Clojure macros do it for you?" > This would be the clojurescript approach, right? > > </over generalization> > > Timothy > > > > -- > “One of the main causes of the fall of the Roman Empire was > that–lacking zero–they had no way to indicate successful termination > of their C programs.” > (Robert Firth) >
_______________________________________________ pypy-dev mailing list [email protected] http://mail.python.org/mailman/listinfo/pypy-dev
