simplify ext/compiler.py
Issue #1331
resolved
you can make a custom compiled object just like this:
class MyThing(ClauseElement):
pass
def _compiler_dispatch(self, compiler):
return "mything"
MyThing._compiler_dispatch = _compiler_dispatch
the UserDefinedCompiler should simplify and not create a new UDC object upon dispatch - there's too much overhead in lookup and such. Let's have UDC just receive the parent compiler as an argument and not be stateful - statefulness will be a very rare use case and they can use the parent compiler for state if need be. let's also think about the above as a super quick "i just need a clause element that does XYZ" - just subclass ClauseElement and add a dispatch method - very convenient.
Comments (3)
-
reporter -
reporter - changed status to resolved
this is in 0.6 and has also been backported to 0.5 for several months now.
-
reporter - removed milestone
Removing milestone: 0.6.0 (automated comment)
- Log in to comment