Review Board 1.5.4

Issue 596 - Under Scala 2.8.0 snippets get instantiated multiple times

Updated 1 year, 6 months ago

Derek Chen-Becker Reviewers
596 dchenbecker, dpp, marius, charles, heiko, joni, atsuhiko, jorge, naftoli, kris, indrajit, alexb, dlouwers, mstarzyk, rmellgren, jhoffman, probinett, jmadsen, mhartmann, jstrachan, jgoday
None LiftWeb-archive
Changes to Scala's non-strict "projection" (deprecated) and "views" (new) methods on Seq make it non-lazy, so now the ListHelpers.first method calls the "_f" function on elements in the Seq multiple times. The effect was noticed when snippet classes were instantiated multiple times. Per advice on the Scala mailing list, the method has been changed to use toStream instead of projection.
On my local Lift test app. 
Ship it!
Posted 1 year, 6 months ago (July 29th, 2010, 10:42 a.m.)
It's kinda funny how first() morphed from my imperative code into functional code that now breaks.  I'm half tempted to put the imperative code back.

As a broader issue, can you find any other places in the code where we're using the buggy projection stuff and make it work right?
  1. I'll go ahead and take a look around and see if we're using either "projection" or "view" and see if it can be fixed. I agree that the change in behavior from 2.7.7 makes it tempting to go and just replace it with a known quantity, but at the same time I'd like to avoid NIH if possible. 
  2. I've opened #607 as an audit task to locate other uses of "projection" and evaluate.
Ship it!
Posted 1 year, 6 months ago (July 29th, 2010, 10:42 a.m.)
It's kinda funny how first() morphed from my imperative code into functional code that now breaks.  I'm half tempted to put the imperative code back.

As a broader issue, can you find any other places in the code where we're using the buggy projection stuff and make it work right?