It's better practice to use DispatchSnippets.  Snippets by convention are
the easy toe in the water, but once you're dealing with state, etc., you
should be graduating to declaring the methods that your snippets support,
thus enforcing the DispatchSnippet being the base class of StatefulSnippet.

On Mon, May 18, 2009 at 6:04 PM, Willis Blackburn <
willis.blackb...@gmail.com> wrote:

>
> I'm back with another question.
>
> I see that StatefulSnippet extends DispatchSnippet.  I understand what
> DispatchSnippet is about.  But what is the reason that a
> StatefulSnippet must also be a DispatchSnippet?  Aren't these concepts
> (stateful vs. stateless, dispatch vs. reflection) unrelated?
>
> Most of the StatefulSnippet examples that I've seen look like this:
>
> class MySnippet extends StatefulSnippet {
>    def dispatch = {
>        case "add" => add _
>        case "edit" => edit _
>        case "foo" => foo _
>    }
>    def add(xhtml : NodeSeq) : ...
>    ...
> }
>
> The dispatch definition doesn't seem to provide much value here.
>
> W
>
>
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to