Re: Build problem. Was: [Lift] accessing the attributes of the XML node associated with a FuncBindParam in bind(...)

2009-01-09 Thread Marius

That's weird. I see that someone modified the code that I committed
moving most of the logic in the trait itself. I'm not sure if David
did that cause in git I see unknown author. I do  like those changes
but I need to look later on today when I get home if they have
something to do with your problem. Since apply functions are
implemented in the trait itself it it seems that compiler does not see
that Info abstract type is in fact a String in the attr object
context. I wonder if it's a compiler bug :D

In my tests I used similar examples as you did and worked with no
problems. But I did not test with latest changed.


Br's,
Marius

On Jan 9, 10:35 am, Marc Boschma marc+lift...@boschma.cx wrote:
 Me either (rather embarrassing, had an old copy of BindHelpers.scala  
 lying about :/ )

 However, a rather strange outcome...

 [WARNING] /Users/marc/src/dad/todo/src/main/scala/com/liftworkshop/
 snippet/TD.scala:99: error: overloaded method value apply with  
 alternatives [T](String,String,
 (net.liftweb.util.BindHelpers.attr.Info) = T,= T)T and [T](String,
 (net.liftweb.util.BindHelpers.attr.Info) = T,= T)T and [T]
 (String,String,(net.liftweb.util.BindHelpers.attr.Info) = T)Option[T]  
 and [T](String,(net.liftweb.util.BindHelpers.attr.Info) =  
 T)Option[T] and (String,String,=  
 net
 .liftweb
 .util.BindHelpers.attr.Info)net.liftweb.util.BindHelpers.attr.Info  
 and (String,=  
 net
 .liftweb
 .util.BindHelpers.attr.Info)net.liftweb.util.BindHelpers.attr.Info  
 and (String,String)Option[net.liftweb.util.BindHelpers.attr.Info]  
 and (String)Option[net.liftweb.util.BindHelpers.attr.Info] cannot be  
 applied to (java.lang.String,(String) = Boolean,() = Boolean)
 [WARNING]               val singular: Boolean = BindHelpers.attr(singular, 
 {s:  
 String = s.toLowerCase match {

 What I find weird is that the references to  
 net.liftweb.util.BindHelpers.attr.Info (NodeSeq)

 The offending line of code:
                  val singular: Boolean = BindHelpers.attr(singular,  
 {s: String = s.toLowerCase match {
                          case  = true
                          case true = true
                          case t = true
                          case yes = true
                          case y = true
                          case _ = false}}, () = false)

 I have also tried

                  val singular: Boolean = BindHelpers.attr(singular,  
 {s: String = s.toLowerCase match {
                          case  = true
                          case true = true
                          case t = true
                          case yes = true
                          case y = true
                          case _ = false}}, false)

 which gets

 [WARNING] /Users/marc/src/dad/todo/src/main/scala/com/liftworkshop/
 snippet/TD.scala:99: error: type mismatch;
 [WARNING]  found   : (String) = Boolean
 [WARNING]  required: (net.liftweb.util.BindHelpers.attr.Info) = Boolean
 [WARNING]               val singular: Boolean = BindHelpers.attr(singular, 
 {s:  
 String = s.toLowerCase match {

 Once again the references to (net.liftweb.util.BindHelpers.attr.Info)  
 = Boolean puzzle me...

 It is like     def apply[T](key: String, f: String = T, default: =  
 T): T = attr(key).map(n = f(n.toString)).getOrElse(default)      
 doesn't match...

 I tried to help the compiler with

                  val singular: Boolean = BindHelpers.attr[Boolean]
 (singular, {s: String = s.toLowerCase match {
                          case  = true
                          case true = true
                          case t = true
                          case yes = true
                          case y = true
                          case _ = false}}, false)

 and got

 [WARNING] /Users/marc/src/dad/todo/src/main/scala/com/liftworkshop/
 snippet/TD.scala:99: error: overloaded method value apply with  
 alternatives (String,String,(net.liftweb.util.BindHelpers.attr.Info)  
 = Boolean,= Boolean)Boolean and (String,
 (net.liftweb.util.BindHelpers.attr.Info) = Boolean,= Boolean)Boolean  
 and (String,String,(net.liftweb.util.BindHelpers.attr.Info) =  
 Boolean)Option[Boolean] and (String,
 (net.liftweb.util.BindHelpers.attr.Info) = Boolean)Option[Boolean]  
 cannot be applied to (java.lang.String,(String) = Boolean,Boolean)
 [WARNING]               val singular: Boolean = BindHelpers.attr[Boolean]
 (singular, {s: String = s.toLowerCase match {

 Marc

 On 09/01/2009, at 3:44 PM, David Pollak wrote:

  Marc,

  Sorry... dunno what to tell you. :-(

  David

  On Thu, Jan 8, 2009 at 3:47 PM, Marc Boschma marc
  +lift...@boschma.cx wrote:
  Very cool indeed, except... I now get:

  [WARNING] /Users/marc/src/todo/src/main/scala/com/liftworkshop/
  snippet/TD.scala:99: error: value attr is not a member of object  
  net.liftweb.util.BindHelpers
  [WARNING]          val singular = BindHelpers.attr(singular, {s: String  
  = s.toLowerCase match {
  [WARNING]                                            ^
  [WARNING] one error found

  I've 

Re: Build problem. Was: [Lift] accessing the attributes of the XML node associated with a FuncBindParam in bind(...)

2009-01-09 Thread David Pollak
On Fri, Jan 9, 2009 at 2:59 AM, Marius marius.dan...@gmail.com wrote:


 That's weird. I see that someone modified the code that I committed
 moving most of the logic in the trait itself. I'm not sure if David
 did that cause in git I see unknown author.


Yep... it was me... from my Windows machine which has a less
than awesome support for Git.


 I do  like those changes
 but I need to look later on today when I get home if they have
 something to do with your problem. Since apply functions are
 implemented in the trait itself it it seems that compiler does not see
 that Info abstract type is in fact a String in the attr object
 context. I wonder if it's a compiler bug :D


Hmmm... that'd suck.




 In my tests I used similar examples as you did and worked with no
 problems. But I did not test with latest changed.


 Br's,
 Marius

 On Jan 9, 10:35 am, Marc Boschma 
 marc+lift...@boschma.cxmarc%2blift...@boschma.cx
 wrote:
  Me either (rather embarrassing, had an old copy of BindHelpers.scala
  lying about :/ )
 
  However, a rather strange outcome...
 
  [WARNING] /Users/marc/src/dad/todo/src/main/scala/com/liftworkshop/
  snippet/TD.scala:99: error: overloaded method value apply with
  alternatives [T](String,String,
  (net.liftweb.util.BindHelpers.attr.Info) = T,= T)T and [T](String,
  (net.liftweb.util.BindHelpers.attr.Info) = T,= T)T and [T]
  (String,String,(net.liftweb.util.BindHelpers.attr.Info) = T)Option[T]
  and [T](String,(net.liftweb.util.BindHelpers.attr.Info) =
  T)Option[T] and (String,String,=
  net
  .liftweb
  .util.BindHelpers.attr.Info)net.liftweb.util.BindHelpers.attr.Info
  and (String,=
  net
  .liftweb
  .util.BindHelpers.attr.Info)net.liftweb.util.BindHelpers.attr.Info
  and (String,String)Option[net.liftweb.util.BindHelpers.attr.Info]
  and (String)Option[net.liftweb.util.BindHelpers.attr.Info] cannot be
  applied to (java.lang.String,(String) = Boolean,() = Boolean)
  [WARNING]   val singular: Boolean =
 BindHelpers.attr(singular, {s:
  String = s.toLowerCase match {
 
  What I find weird is that the references to
  net.liftweb.util.BindHelpers.attr.Info (NodeSeq)
 
  The offending line of code:
   val singular: Boolean = BindHelpers.attr(singular,
  {s: String = s.toLowerCase match {
   case  = true
   case true = true
   case t = true
   case yes = true
   case y = true
   case _ = false}}, () = false)
 
  I have also tried
 
   val singular: Boolean = BindHelpers.attr(singular,
  {s: String = s.toLowerCase match {
   case  = true
   case true = true
   case t = true
   case yes = true
   case y = true
   case _ = false}}, false)
 
  which gets
 
  [WARNING] /Users/marc/src/dad/todo/src/main/scala/com/liftworkshop/
  snippet/TD.scala:99: error: type mismatch;
  [WARNING]  found   : (String) = Boolean
  [WARNING]  required: (net.liftweb.util.BindHelpers.attr.Info) = Boolean
  [WARNING]   val singular: Boolean =
 BindHelpers.attr(singular, {s:
  String = s.toLowerCase match {
 
  Once again the references to (net.liftweb.util.BindHelpers.attr.Info)
  = Boolean puzzle me...
 
  It is like def apply[T](key: String, f: String = T, default: =
  T): T = attr(key).map(n = f(n.toString)).getOrElse(default)
  doesn't match...
 
  I tried to help the compiler with
 
   val singular: Boolean = BindHelpers.attr[Boolean]
  (singular, {s: String = s.toLowerCase match {
   case  = true
   case true = true
   case t = true
   case yes = true
   case y = true
   case _ = false}}, false)
 
  and got
 
  [WARNING] /Users/marc/src/dad/todo/src/main/scala/com/liftworkshop/
  snippet/TD.scala:99: error: overloaded method value apply with
  alternatives (String,String,(net.liftweb.util.BindHelpers.attr.Info)
  = Boolean,= Boolean)Boolean and (String,
  (net.liftweb.util.BindHelpers.attr.Info) = Boolean,= Boolean)Boolean
  and (String,String,(net.liftweb.util.BindHelpers.attr.Info) =
  Boolean)Option[Boolean] and (String,
  (net.liftweb.util.BindHelpers.attr.Info) = Boolean)Option[Boolean]
  cannot be applied to (java.lang.String,(String) = Boolean,Boolean)
  [WARNING]   val singular: Boolean = BindHelpers.attr[Boolean]
  (singular, {s: String = s.toLowerCase match {
 
  Marc
 
  On 09/01/2009, at 3:44 PM, David Pollak wrote:
 
   Marc,
 
   Sorry... dunno what to tell you. :-(
 
   David
 
   On Thu, Jan 8, 2009 at 3:47 PM, Marc Boschma marc
   +lift...@boschma.cx wrote:
   Very cool indeed, except... I now get:
 
   [WARNING] /Users/marc/src/todo/src/main/scala/com/liftworkshop/
   

Re: Build problem. Was: [Lift] accessing the attributes of the XML node associated with a FuncBindParam in bind(...)

2009-01-09 Thread Marius

I hate git on windows ... I use it for the book unfortunatelly.

On Jan 9, 1:46 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Fri, Jan 9, 2009 at 2:59 AM, Marius marius.dan...@gmail.com wrote:

  That's weird. I see that someone modified the code that I committed
  moving most of the logic in the trait itself. I'm not sure if David
  did that cause in git I see unknown author.

 Yep... it was me... from my Windows machine which has a less
 than awesome support for Git.

  I do  like those changes
  but I need to look later on today when I get home if they have
  something to do with your problem. Since apply functions are
  implemented in the trait itself it it seems that compiler does not see
  that Info abstract type is in fact a String in the attr object
  context. I wonder if it's a compiler bug :D

 Hmmm... that'd suck.

Oh yeah big time ... If indeed my assumption is correct (which I need
to verify) I'll open a compiler bug and see if I can fix it. Worst
case scenario rollback ... which I hope it won't be the case.






  In my tests I used similar examples as you did and worked with no
  problems. But I did not test with latest changed.

  Br's,
  Marius

  On Jan 9, 10:35 am, Marc Boschma 
  marc+lift...@boschma.cxmarc%2blift...@boschma.cx
  wrote:
   Me either (rather embarrassing, had an old copy of BindHelpers.scala
   lying about :/ )

   However, a rather strange outcome...

   [WARNING] /Users/marc/src/dad/todo/src/main/scala/com/liftworkshop/
   snippet/TD.scala:99: error: overloaded method value apply with
   alternatives [T](String,String,
   (net.liftweb.util.BindHelpers.attr.Info) = T,= T)T and [T](String,
   (net.liftweb.util.BindHelpers.attr.Info) = T,= T)T and [T]
   (String,String,(net.liftweb.util.BindHelpers.attr.Info) = T)Option[T]
   and [T](String,(net.liftweb.util.BindHelpers.attr.Info) =
   T)Option[T] and (String,String,=
   net
   .liftweb
   .util.BindHelpers.attr.Info)net.liftweb.util.BindHelpers.attr.Info
   and (String,=
   net
   .liftweb
   .util.BindHelpers.attr.Info)net.liftweb.util.BindHelpers.attr.Info
   and (String,String)Option[net.liftweb.util.BindHelpers.attr.Info]
   and (String)Option[net.liftweb.util.BindHelpers.attr.Info] cannot be
   applied to (java.lang.String,(String) = Boolean,() = Boolean)
   [WARNING]               val singular: Boolean =
  BindHelpers.attr(singular, {s:
   String = s.toLowerCase match {

   What I find weird is that the references to
   net.liftweb.util.BindHelpers.attr.Info (NodeSeq)

   The offending line of code:
                    val singular: Boolean = BindHelpers.attr(singular,
   {s: String = s.toLowerCase match {
                            case  = true
                            case true = true
                            case t = true
                            case yes = true
                            case y = true
                            case _ = false}}, () = false)

   I have also tried

                    val singular: Boolean = BindHelpers.attr(singular,
   {s: String = s.toLowerCase match {
                            case  = true
                            case true = true
                            case t = true
                            case yes = true
                            case y = true
                            case _ = false}}, false)

   which gets

   [WARNING] /Users/marc/src/dad/todo/src/main/scala/com/liftworkshop/
   snippet/TD.scala:99: error: type mismatch;
   [WARNING]  found   : (String) = Boolean
   [WARNING]  required: (net.liftweb.util.BindHelpers.attr.Info) = Boolean
   [WARNING]               val singular: Boolean =
  BindHelpers.attr(singular, {s:
   String = s.toLowerCase match {

   Once again the references to (net.liftweb.util.BindHelpers.attr.Info)
   = Boolean puzzle me...

   It is like     def apply[T](key: String, f: String = T, default: =
   T): T = attr(key).map(n = f(n.toString)).getOrElse(default)
   doesn't match...

   I tried to help the compiler with

                    val singular: Boolean = BindHelpers.attr[Boolean]
   (singular, {s: String = s.toLowerCase match {
                            case  = true
                            case true = true
                            case t = true
                            case yes = true
                            case y = true
                            case _ = false}}, false)

   and got

   [WARNING] /Users/marc/src/dad/todo/src/main/scala/com/liftworkshop/
   snippet/TD.scala:99: error: overloaded method value apply with
   alternatives (String,String,(net.liftweb.util.BindHelpers.attr.Info)
   = Boolean,= Boolean)Boolean and (String,
   (net.liftweb.util.BindHelpers.attr.Info) = Boolean,= Boolean)Boolean
   and (String,String,(net.liftweb.util.BindHelpers.attr.Info) =
   Boolean)Option[Boolean] and (String,
   (net.liftweb.util.BindHelpers.attr.Info) = Boolean)Option[Boolean]
   cannot be applied to (java.lang.String,(String) = Boolean,Boolean)
   [WARNING]               val 

Re: Build problem. Was: [Lift] accessing the attributes of the XML node associated with a FuncBindParam in bind(...)

2009-01-09 Thread Marius

Ok I don't think it is a compiler bug.


Marc called it like:

var singular = BindHelpers.attr(singular, {s: String =
{s.toLowerCase ...}, false}

BUT

the apply function is defined as

def apply[T](key: String, f: Info = T, default: = T): T

Note that function f takes an Info not a T as parameter and for attr
object Info = NodeSeq and not String.

= compiler errors.

So Marc your conversion function is provided here with a NodeSeq and
not a String so you can say:

var singular = BindHelpers.attr[Boolean](singular, {s: NodeSeq=
{...}, false}



Br's,
Marius

On Jan 9, 2:59 pm, Marius marius.dan...@gmail.com wrote:
 I hate git on windows ... I use it for the book unfortunatelly.

 On Jan 9, 1:46 pm, David Pollak feeder.of.the.be...@gmail.com
 wrote:



  On Fri, Jan 9, 2009 at 2:59 AM, Marius marius.dan...@gmail.com wrote:

   That's weird. I see that someone modified the code that I committed
   moving most of the logic in the trait itself. I'm not sure if David
   did that cause in git I see unknown author.

  Yep... it was me... from my Windows machine which has a less
  than awesome support for Git.

   I do  like those changes
   but I need to look later on today when I get home if they have
   something to do with your problem. Since apply functions are
   implemented in the trait itself it it seems that compiler does not see
   that Info abstract type is in fact a String in the attr object
   context. I wonder if it's a compiler bug :D

  Hmmm... that'd suck.

 Oh yeah big time ... If indeed my assumption is correct (which I need
 to verify) I'll open a compiler bug and see if I can fix it. Worst
 case scenario rollback ... which I hope it won't be the case.



   In my tests I used similar examples as you did and worked with no
   problems. But I did not test with latest changed.

   Br's,
   Marius

   On Jan 9, 10:35 am, Marc Boschma 
   marc+lift...@boschma.cxmarc%2blift...@boschma.cx
   wrote:
Me either (rather embarrassing, had an old copy of BindHelpers.scala
lying about :/ )

However, a rather strange outcome...

[WARNING] /Users/marc/src/dad/todo/src/main/scala/com/liftworkshop/
snippet/TD.scala:99: error: overloaded method value apply with
alternatives [T](String,String,
(net.liftweb.util.BindHelpers.attr.Info) = T,= T)T and [T](String,
(net.liftweb.util.BindHelpers.attr.Info) = T,= T)T and [T]
(String,String,(net.liftweb.util.BindHelpers.attr.Info) = T)Option[T]
and [T](String,(net.liftweb.util.BindHelpers.attr.Info) =
T)Option[T] and (String,String,=
net
.liftweb
.util.BindHelpers.attr.Info)net.liftweb.util.BindHelpers.attr.Info
and (String,=
net
.liftweb
.util.BindHelpers.attr.Info)net.liftweb.util.BindHelpers.attr.Info
and (String,String)Option[net.liftweb.util.BindHelpers.attr.Info]
and (String)Option[net.liftweb.util.BindHelpers.attr.Info] cannot be
applied to (java.lang.String,(String) = Boolean,() = Boolean)
[WARNING]               val singular: Boolean =
   BindHelpers.attr(singular, {s:
String = s.toLowerCase match {

What I find weird is that the references to
net.liftweb.util.BindHelpers.attr.Info (NodeSeq)

The offending line of code:
                 val singular: Boolean = BindHelpers.attr(singular,
{s: String = s.toLowerCase match {
                         case  = true
                         case true = true
                         case t = true
                         case yes = true
                         case y = true
                         case _ = false}}, () = false)

I have also tried

                 val singular: Boolean = BindHelpers.attr(singular,
{s: String = s.toLowerCase match {
                         case  = true
                         case true = true
                         case t = true
                         case yes = true
                         case y = true
                         case _ = false}}, false)

which gets

[WARNING] /Users/marc/src/dad/todo/src/main/scala/com/liftworkshop/
snippet/TD.scala:99: error: type mismatch;
[WARNING]  found   : (String) = Boolean
[WARNING]  required: (net.liftweb.util.BindHelpers.attr.Info) = Boolean
[WARNING]               val singular: Boolean =
   BindHelpers.attr(singular, {s:
String = s.toLowerCase match {

Once again the references to (net.liftweb.util.BindHelpers.attr.Info)
= Boolean puzzle me...

It is like     def apply[T](key: String, f: String = T, default: =
T): T = attr(key).map(n = f(n.toString)).getOrElse(default)
doesn't match...

I tried to help the compiler with

                 val singular: Boolean = BindHelpers.attr[Boolean]
(singular, {s: String = s.toLowerCase match {
                         case  = true
                         case true = true
                         case t = true
                         case yes = true

Re: Build problem. Was: [Lift] accessing the attributes of the XML node associated with a FuncBindParam in bind(...)

2009-01-09 Thread Marc Boschma

Ok, cool to see the attr.apply code aligned with the trait.

One simple question - is it safe to assume the Info/NodeSeq will never  
be null?

Marc

On 10/01/2009, at 2:53 AM, Marius wrote:


 Ok I don't think it is a compiler bug.


 Marc called it like:

 var singular = BindHelpers.attr(singular, {s: String =
 {s.toLowerCase ...}, false}

 BUT

 the apply function is defined as

 def apply[T](key: String, f: Info = T, default: = T): T

 Note that function f takes an Info not a T as parameter and for attr
 object Info = NodeSeq and not String.

 = compiler errors.

 So Marc your conversion function is provided here with a NodeSeq and
 not a String so you can say:

 var singular = BindHelpers.attr[Boolean](singular, {s: NodeSeq=
 {...}, false}



 Br's,
 Marius

 On Jan 9, 2:59 pm, Marius marius.dan...@gmail.com wrote:
 I hate git on windows ... I use it for the book unfortunatelly.

 On Jan 9, 1:46 pm, David Pollak feeder.of.the.be...@gmail.com
 wrote:



 On Fri, Jan 9, 2009 at 2:59 AM, Marius marius.dan...@gmail.com  
 wrote:

 That's weird. I see that someone modified the code that I committed
 moving most of the logic in the trait itself. I'm not sure if David
 did that cause in git I see unknown author.

 Yep... it was me... from my Windows machine which has a less
 than awesome support for Git.

 I do  like those changes
 but I need to look later on today when I get home if they have
 something to do with your problem. Since apply functions are
 implemented in the trait itself it it seems that compiler does  
 not see
 that Info abstract type is in fact a String in the attr object
 context. I wonder if it's a compiler bug :D

 Hmmm... that'd suck.

 Oh yeah big time ... If indeed my assumption is correct (which I need
 to verify) I'll open a compiler bug and see if I can fix it. Worst
 case scenario rollback ... which I hope it won't be the case.



 In my tests I used similar examples as you did and worked with no
 problems. But I did not test with latest changed.

 Br's,
 Marius

 On Jan 9, 10:35 am, Marc Boschma marc+lift...@boschma.cxmarc 
 %2blift...@boschma.cx
 wrote:
 Me either (rather embarrassing, had an old copy of  
 BindHelpers.scala
 lying about :/ )

 However, a rather strange outcome...

 [WARNING] /Users/marc/src/dad/todo/src/main/scala/com/ 
 liftworkshop/
 snippet/TD.scala:99: error: overloaded method value apply with
 alternatives [T](String,String,
 (net.liftweb.util.BindHelpers.attr.Info) = T,= T)T and [T] 
 (String,
 (net.liftweb.util.BindHelpers.attr.Info) = T,= T)T and [T]
 (String,String,(net.liftweb.util.BindHelpers.attr.Info) =  
 T)Option[T]
 and [T](String,(net.liftweb.util.BindHelpers.attr.Info) =
 T)Option[T] and (String,String,=
 net
 .liftweb
 .util.BindHelpers.attr.Info)net.liftweb.util.BindHelpers.attr.Info
 and (String,=
 net
 .liftweb
 .util.BindHelpers.attr.Info)net.liftweb.util.BindHelpers.attr.Info
 and  
 (String,String)Option[net.liftweb.util.BindHelpers.attr.Info]
 and (String)Option[net.liftweb.util.BindHelpers.attr.Info]  
 cannot be
 applied to (java.lang.String,(String) = Boolean,() = Boolean)
 [WARNING]   val singular: Boolean =
 BindHelpers.attr(singular, {s:
 String = s.toLowerCase match {

 What I find weird is that the references to
 net.liftweb.util.BindHelpers.attr.Info (NodeSeq)

 The offending line of code:
  val singular: Boolean =  
 BindHelpers.attr(singular,
 {s: String = s.toLowerCase match {
  case  = true
  case true = true
  case t = true
  case yes = true
  case y = true
  case _ = false}}, () = false)

 I have also tried

  val singular: Boolean =  
 BindHelpers.attr(singular,
 {s: String = s.toLowerCase match {
  case  = true
  case true = true
  case t = true
  case yes = true
  case y = true
  case _ = false}}, false)

 which gets

 [WARNING] /Users/marc/src/dad/todo/src/main/scala/com/ 
 liftworkshop/
 snippet/TD.scala:99: error: type mismatch;
 [WARNING]  found   : (String) = Boolean
 [WARNING]  required: (net.liftweb.util.BindHelpers.attr.Info) =  
 Boolean
 [WARNING]   val singular: Boolean =
 BindHelpers.attr(singular, {s:
 String = s.toLowerCase match {

 Once again the references to  
 (net.liftweb.util.BindHelpers.attr.Info)
 = Boolean puzzle me...

 It is like def apply[T](key: String, f: String = T,  
 default: =
 T): T = attr(key).map(n = f(n.toString)).getOrElse(default)
 doesn't match...

 I tried to help the compiler with

  val singular: Boolean = BindHelpers.attr[Boolean]
 (singular, {s: String = s.toLowerCase match {
  case  = true
  case true = true
  case t = true
   

[Lift] accessing the attributes of the XML node associated with a FuncBindParam in bind(...)

2009-01-05 Thread Marc Boschma

I have been playing with the ToDo example application and having fun  
in manipulating XML.

With the todo:list/ node I thought it would be good if the XHTML  
designer could pass in some guidance to the doList(...) method used in  
bind(..). ie. todo:list singular=true.../todo:list

Looking over the bind code I noticed that the attributes are not  
accessible without ending up changing the calcValue method's  
signature. I did initially try to knock up a

case class FuncWithAttrBindParam(name: String, value: (NodeSeq,  
MetaData) = NodeSeq) extends Tuple2(name, value) with BindParam

and a corresponding

case Some(ns : FuncWithAttrBindParam) =

in in_bind(...), but it all looks like a huge kludge.

It strikes me as a little deficient to be able to utilise attributes  
within the context of a snippet and yet not within a bind. I know bind  
is quite embedded in lift now, but I think that this difference might  
prove a little frustrating. I know one solution is to just create a  
bind(todo, html,
 exclude -  
ajaxCheckbox(QueryNotDone, v = {QueryNotDone(v); reDraw}),
 list - doList(reDraw, false) _,
list_singular - doList(reDraw, true) _)

But I think from the XHtml designer's perspective that is counter  
intuitive...

Thoughts?

--

It should be noted that this is different to the case class  
FuncAttrBindParam(name: String, value: NodeSeq = NodeSeq, newAttr:  
String) extends BindParam with BindWithAttr. Which interesting enough  
has no corresponding SuperArrowAssoc - method match. Maybe

def -(t: Tuple2[String, NodeSeq]) = AttrBindParam(name, t._2, t._1)
def -(t: Tuple2[String, NodeSeq = NodeSeq]) =  
FuncAttrBindParam(name, t._2, t._1)

And maybe even...

def -[T](t: Tuple2[String, T]) = FuncAttrBindParam(name, (name -  
t._2).calcValue _, t._1)

or

def -[T](t: Tuple2[String, T]) = FuncAttrBindParam(name, (t._1 -  
t._2).calcValue _, t._1)

I'm not sure which is better on the last two... Just a thought.

Marc


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---