Hi, all, I have committed a number of enhancements to Loc & LocParam which involves a number of breaking changes. The changes and their rationale is listed below. Unless you have created your own subclasses of Loc or LocParam, these changes should not have any repercussions for you. If the effect of any of these changes on your particular codebase are excessively disruptive, please contact me and I will work with you to resolve the issue.
Breaking Changes: 1) LocParam LocParam has been made a sealed trait to facilitate pattern matching within the Lift codebase and has had a contravariant type parameter added to its type to facilitate typesafe interactions with Loc[T]. The new trait is hence LocParam[-T]. As LocParam is now a sealed trait, I have added an extension point for user-specified LocParam subtypes as UserLocParam[-T] extends LocParam[T]. Since the new type parameter is contravariant, LocParam subclasses that are applicable for any Loc[T] have the type LocParam[Any], and a type alias AnyLocParam has been added for this type. The Loc.checkProtected method now enforces type consistency between the evaluated Link[T] and the list of LocParam[T] which are used to evaluate whether the link is accessible given the specified parameters. 2) Renames Previously, the "Param" suffix was used for two unrelated purposes within Loc: first, to refer to the type parameter of the Loc, and secondly for the LocParam configuration. This overloading made the code and the API somewhat difficult to read, so the first usage has been removed resulting in the following renames: ParamType => T NullLocParams => //removed, Unit is sufficient! Loc.defaultParams => Loc.defaultValue Loc.forceParam => Loc.overrideValue Loc.foundParam => Loc.requestValue Loc.additionalKidParams => Loc.childValues After this change, all instances of the "param" name within Loc should refer to something having to do with LocParam instances. Non-Breaking Additions: case class IfValue[T](test: Box[T] => Boolean, failMsg: FailMsg) extends LocParam[T] case class UnlessValue[T](test: Box[T] => Boolean, failMsg: FailMsg) extends LocParam[T] case class TestValueAccess[T](func: Box[T] => Box[LiftResponse]) extends LocParam[T] If you are using a non-Unit typed Loc, you can use these LocParam instances to enforce access rules at the value level. case class ValueTemplate[T](template: Box[T] => NodeSeq) extends LocParam[T] //per-value template selection DataLoc[T] subclass of Loc was added to facilitate the use of the new more typeful LocParam subtypes. A few changes to Link: Since Link.createLink creates a Box[Text] (and not a clickable link) a couple of methods were added to create the intermediate, unboxed values in order that subclasses can more easily manipulate the resulting path: Link.pathList(value: T): List[String] // added to facilitate creation of value-aware paths by subclasses. Link.createPath(value: T): String //creates the String representation of the path that is subsequently turned into XML and boxed by Link.createLink Again, please let me know if any of these changes cause you headaches! My hope is that much of the modified functionality has not been used by very many people yet and that as a result it's a good time to make these changes before typeful Locs get too widely used to make breaking changes. Thanks, Kris --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
