Latest Lift 2.5 Snapshot Doesn't allow passing in NodeSeqs?

Showing 1-5 of 5 messages
Latest Lift 2.5 Snapshot Doesn't allow passing in NodeSeqs? Matt Farmer 8/30/12 12:01 PM
Hey everybody,

I know that we're nearing a code freeze for the 2.5-M1 release, so I wanted to make sure I brought this to everyone's attention. I updated the copy of the Lift snapshot that I'm running today to find that there were some compile bugs when attempting to pass NodeSeqs directly into CSS selector functions. So, for example, a line like this:

("script [src]" #> jQueryUrl)(xhtml)

Yields a type mismatch error:

[error]  found   : scala.xml.NodeSeq
[error]  required: net.liftweb.util.ComputeTransformRules[String]

Of course, String is the type of the jQueryUrl variable. However, when I roll back to commit aae6082bcea0420b9d2cbc87a7cc85e4b74a6c30, where Antonio's AJAX stuff was merged, everything compiles fine. So it was introduced in the recent batch of commits. Is this a known side effect of an intentional change or no? I'm also seeing other errors that seem to imply that something may be wrong. Among them...

[error]  found   : Int with scala.xml.NodeSeq => scala.xml.NodeSeq
[error]  required: scala.xml.NodeSeq

I don't have time right this second to work up an example project, but if whoever reads this feels like I should I am certainly able to. All the same, I wanted to make sure this at least got mentioned regardless of my insane schedule so that it doesn't catch anybody by surprise when the M1 rolls.

Cheers,

Matt Farmer
Re: [Lift] Latest Lift 2.5 Snapshot Doesn't allow passing in NodeSeqs? fmpwizard 8/30/12 12:04 PM
On Thu, Aug 30, 2012 at 3:01 PM, Matt Farmer <matt....@openstudy.com> wrote:
> Hey everybody,
>
> I know that we're nearing a code freeze for the 2.5-M1 release, so I wanted
> to make sure I brought this to everyone's attention. I updated the copy of
> the Lift snapshot that I'm running today to find that there were some
> compile bugs when attempting to pass NodeSeqs directly into CSS selector
> functions. So, for example, a line like this:
>
> ("script [src]" #> jQueryUrl)(xhtml)


This is due to the new type class based css transform, if memory
serves well, you can get around this by using:

 ("script [src]" #> jQueryUrl).apply(xhtml)

I wish I could find the email where I saw that, I'll keep looking just in case.

Thanks

  Diego


>
> Yields a type mismatch error:
>
> [error]  found   : scala.xml.NodeSeq
> [error]  required: net.liftweb.util.ComputeTransformRules[String]
>
> Of course, String is the type of the jQueryUrl variable. However, when I
> roll back to commit aae6082bcea0420b9d2cbc87a7cc85e4b74a6c30, where
> Antonio's AJAX stuff was merged, everything compiles fine. So it was
> introduced in the recent batch of commits. Is this a known side effect of an
> intentional change or no? I'm also seeing other errors that seem to imply
> that something may be wrong. Among them...
>
> [error]  found   : Int with scala.xml.NodeSeq => scala.xml.NodeSeq
> [error]  required: scala.xml.NodeSeq
>
> I don't have time right this second to work up an example project, but if
> whoever reads this feels like I should I am certainly able to. All the same,
> I wanted to make sure this at least got mentioned regardless of my insane
> schedule so that it doesn't catch anybody by surprise when the M1 rolls.
>
> Cheers,
>
> Matt Farmer
>
> --
> --
> Lift, the simply functional web framework: http://liftweb.net
> Code: http://github.com/lift
> Discussion: http://groups.google.com/group/liftweb
> Stuck? Help us help you:
> https://www.assembla.com/wiki/show/liftweb/Posting_example_code
>
>
>



--
Diego Medina
Lift/Scala Developer
di...@fmpwizard.com
http://www.fmpwizard.com
Re: [Lift] Latest Lift 2.5 Snapshot Doesn't allow passing in NodeSeqs? andreak 8/30/12 12:05 PM
This is a consequence of using type-classes for CSS Selector Transforms, so you'll have to re-write those to:
(".stuff" #> jQueryUrl).apply(xhtml)

Or scala thinks (xhtml) is an explicit parameter for the implicit used by the type-class
-- 
Andreas Joseph Krogh<and...@officenet.no>  - mob: +47 909 56 963
Senior Software Developer / CEO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc
Re: [Lift] Latest Lift 2.5 Snapshot Doesn't allow passing in NodeSeqs? fmpwizard 8/30/12 12:14 PM
Yes ( I think):

scala> import net.liftweb.util.Helpers._
import net.liftweb.util.Helpers._

scala> ("script [src]" #> "jQueryUrl")(<script src="here">data</script>)
<console>:11: error: type mismatch;
 found   : scala.xml.Elem
 required: net.liftweb.util.ComputeTransformRules[java.lang.String]
       ("script [src]" #> "jQueryUrl")(<script src="here">data</script>)
                                        ^

scala> import xml.NodeSeq
import xml.NodeSeq

scala> ("script [src]" #> "jQueryUrl")(<script src="here">data</script>)
<console>:12: error: type mismatch;
 found   : scala.xml.Elem
 required: net.liftweb.util.ComputeTransformRules[java.lang.String]
       ("script [src]" #> "jQueryUrl")(<script src="here">data</script>)
                                        ^

scala> ("script [src]" #> "jQueryUrl").apply(<script src="here">data</script>)
res2: scala.xml.NodeSeq = NodeSeq(<script src="jQueryUrl">data</script>)

scala>

Regards,
This message has been hidden because it was flagged for abuse.