I'm not sure if this is the case ... if we want context dependent
Snippets then probably using loc snippets is the right place
How about something like:
abstract class RulesSeq[T] {
var rules : List[T] = Nil
private def safe_?(f : => Any) {
doneBoot match {
case false => f
case _ => throw new IllegalStateException("Can not modify after
boot.");
}
}
def prependRule(r: T) {
safe_? {
rules = r :: rules
}
}
def appendRule(r: T) {
safe_? {
rules = rules ::: List(r)
}
}
}
Br's,
marius
On Dec 9, 10:12 pm, "Jorge Ortiz" <[EMAIL PROTECTED]> wrote:
> Hmmmmm... I can think of situations where such mutations are useful after
> Boot (app/prependSnippet comes to mind). Maybe they can be made immutable
> (.toList) as necessary?
>
> --j
>
> On Tue, Dec 9, 2008 at 2:01 PM, David Pollak
> <[EMAIL PROTECTED]>wrote:
>
> > And we should freeze the lists after Boot is finished. The permutation
> > methods should throw exceptions post-boot
>
> > On Dec 9, 2008 11:39 AM, "Jorge Ortiz" <[EMAIL PROTECTED]> wrote:
>
> > Seems like prime opportunity for an abstraction...
>
> > Why not make them (*gasp*) mutable data structures with prepend/append
> > methods?
>
> > --j
>
> > On Tue, Dec 9, 2008 at 1:35 PM, Marius <[EMAIL PROTECTED]> wrote: >
> > > > Hi. > > Unfortunatel...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Lift" 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/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---