Christian Iversen
unread,Jul 26, 2013, 12:44:22 PM7/26/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pyj...@googlegroups.com
Hello world!
It's the dear leader here. I feel like I've made some real progress,
which I would like to share with you:
>>> FAILED (failures=10)
This is with a whole host of new brütal unit tests, which the old
compiler fails on. All in all, I think we have the same number of
failing unit tests for the new and old compiler now.
The new compiler support several new pieces of basic syntax (compound
boolean operators, for-else, while-else, try-else, nested list
comprehension, and more), while still lacking a little bit in class
support. Thus, the "same number of failing tests" doesn't mean that the
same _things_ are failing.
A few things still are not supported in Pyjaco v2.0:
- Class decorators
- Function decorators in class methods
- Multiple inheritance
- Metaclasses
- Nested classes
- Generator expressions
- Yield
- The __getattribute__ "real" magic that happens
- Modules
The 10 failures in the current test suite are all because of missing
support for certain features in classes (almost all of them are because
of missing @staticmethod).
The old class system is essentially a hack, and I'm looking at whether
it would be best to re-implement the old hacks, or try and innovate a
little bit.
I can definitely see 4 out of the 6 mentioned problems go away if we
implement a bit of new compiler code for geneerating classes.
It would also enourmeously streamline the internals, since what I'm
considering is implementing type(). Here's what that means:
In python, when you do:
class foo(bar):
def func(self):
return 42
you are telling python to create a new class object, which should
inherit from "bar" and contain a function "func". It is equivalent to
the following line:
def func(self):
return 42
foo = type("foo", (bar,), {"func": func})
Now, in the current compiler, this same class would be constructed
approximately like so:
var foo = __inherit(bar, "foo", <true or false>);
foo.PY$func = function() { return int(42); }
...
Now, the similarity between __inherit() and type() should be pretty
clear. Not only would removing __inherit cause a lot of other problems
to go away, it would also make type() work, which would mean that
dynamic class creation, metaclasses, class decorators and the like would
either automagically work, or be very simple to support. Additionally,
since the current road block for MRO (Method Resolution Order, for
Multiple Inheritance) is that we don't have a flattened class
inheritance list, multiple inheritance would also be relatively easy to
support.
So that's what I'm working on at the moment. Any comments about the new
class system, or anything else pyjaco-related?
/Dear leader out
--
Med venlig hilsen
Christian Iversen