On Aug 16, 8:48 pm, Christoph Zwerschke <[email protected]> wrote:
> Am 17.08.2010 01:33 schrieb Phillip J. Eby:
>  > So, I guess what I'm saying is that PEAK-Rules has *always* had
>  > priorities -- they're just called "putting the base cases in the body"
>  > and "use @around methods for things that need to take precedence over
>  > everything else".
>
> Well, sometimes you still may want to have more levels of priority.

Btw, you can also now make your own method-based priority levels as
simply as:

    class MyLevel2(Method): pass
    when_level2 = MyLevel2.make_decorator()

    class MyLevel3(Method): pass
    when_level3 = MyLevel3.make_decorator()

    class Default(Method): pass
    when_default = Default.make_decorator()

    (Around, Before, After) >> MyLevel3 >> MyLevel2 >> (Method,
MethodList) >> Default

The '>>' operator on method types defines a partial ordering graph,
though ordering is undefined between types you haven't explicitly
shown a precedence for.  So the above says that Around, Before, and
After are higher precedence than all your new methods, and then those
are higher than Method/MethodList, and finally default.  (You could
skip most of that if you just wanted to define a "when_default" for
defining all your non-around defaults.)

> Regarding TurboJson, you're right though, the existing functionality
> should suffice and your ideas look like reasonable solutions to me. I'll
> probably try to change TurboJson to work along these lines you pointed
> out and see if I can get it done without breaking backward
> compatibility.

Based on the mailing list posts I've been able to find, I think it
will be backward-compatible; if not, please let me know what you
find.  Be sure to also see:

  http://www.eby-sarna.com/pipermail/peak/2010-August/003382.html

If you haven't already.


> TurboJson was developed on rule-dispatch originally
> (which didn't have an "around" iirc), and later people probably only
> added upon that without really thinking about how to do it properly.

Or *asking*, either. ;-)


> Your explanations and hints are highly welcome. It takes some time to
> get a feeling for how to adequately apply generic functions.
>
> Btw, while TG1 heavily relied on generic functions, TG2 does not use
> them any more and also recently ditched TurboJson. I guess the reason is
> that rule-dispatch and peak-rules can cause installation troubles, and
> people seem to have difficulties to wrap their head around generic
> functions generally. Maybe you need to do explain and advertize more ;-)

Yes, I do.  My recent blog post is a step in that direction; there
will be more leading up to the first official release.

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to