On Fri, Jan 22, 2010 at 12:57 PM, Naftoli Gugenheim <[email protected]>wrote:
> Sorry for not being more precise. > If I understood you, you said there are times where a function whose return > value is *not* used, You misunderstood me. > but still code broke when the expected type was changed to the more correct > Unit. Is that not what you were referring to when you said you don't > remember why but it broke a lot of code? > > ------------------------------------- > David Pollak<[email protected]> wrote: > > On Fri, Jan 22, 2010 at 10:36 AM, Naftoli Gugenheim <[email protected] > >wrote: > > > I'm curious to know the difference between returning Any or Unit, if you > > remember. Is it possible it was a bug in Scala? > > > > Returning Any returns the value of the last expression in the function. > Returning Unit always returns the Unit instance. In some places (I think > when processing Ajax forms) we take the return value from the functions and > try to determine if they are meant as JavaScript or somesuch to be sent > back > to the browser. > > > > > > ------------------------------------- > > David Pollak<[email protected]> wrote: > > > > On Fri, Jan 22, 2010 at 2:22 AM, Marius <[email protected]> wrote: > > > > > This same thing is also touched by > http://reviewboard.liftweb.net/r/184/ > > > (driven by Kris' post) > > > > > > Do you agree with these following statements: > > > > > > 1. The SHtml Ajax function should return JsCmd > > > > > > > Yes. > > > > > > > 2. The SHtml non Ajax function should return a Unit instead of Any > > > (unless there are compelling reasons to keep Any) > > > > > > > There is a compelling reason to keep Any. I can't remember it right now, > > but there is a really, really good reason (I've made the change to Unit > in > > the past and it broke a pile of stuff in my applications.) > > > > > > > > > > If so I could probably make the adjustments today since I'm on that > > > defect anyways. > > > > > > Br's, > > > Marius > > > > > > On Jan 22, 5:48 am, David Pollak <[email protected]> > > > wrote: > > > > On Mon, Jan 18, 2010 at 10:31 AM, Felipe Rodrigues < > > > > > > > > [email protected]> wrote: > > > > > That's a little better.. thanks > > > > > > > > Originally, the function returned Any... and this led to problems > > (people > > > > returning HTML, Strings, etc.) It turns out that 95% of the time, > you > > > want > > > > to do something to tell the user that the server did something > (unless > > > the > > > > function sends a message to a CometActor), so using the type-system > to > > > make > > > > sure Ajax functions returned JsCmds was the right answer. > > > > > > > > > > > > > > > > > > > > > > > > > greekscala wrote: > > > > > > > > >> Hello, > > > > > > > > >> know what you mean. You can use JsCmds._Noop to return "nohting" > as > > > > >> JsCmd. > > > > > > > > >> best regards > > > > > > > > >> On 18 Jan., 17:25, Felipe Rodrigues <[email protected]> > > > > >> wrote: > > > > > > > > >>> Here is how I made it, but seems ugly: > > > > > > > > >>> SHtml.a(() => {serverSideFunction(t.text); Call("void", > > Num(0)).cmd}, > > > t) > > > > > > > > >>> It is awkward having to add a JsCmd even when I don't need it. > > > > > > > > >>> Felipe > > > > > > > > >>> Naftoli Gugenheim wrote: > > > > > > > > >>>> Never mind my question; I hadn't paid attention to the subject. > > > > >>>> ------------------------------------- > > > > >>>> Felipe Rodrigues<[email protected]> wrote: > > > > >>>> Hi all, > > > > >>>> I want to create a link which when clicked calls a server > > side > > > > >>>> function. > > > > >>>> No need for JavaScript callback. > > > > >>>> I tried with no success: > > > > >>>> SHtml.a(() => {serverSideFunction(t.text)}, t) > > > > >>>> Any idea how can I accomplish that will be appreciated. > > > > >>>> Thanks, > > > > >>>> Felipe > > > > > > > > > -- > > > > > 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]<liftweb%[email protected]> > <liftweb%[email protected]<liftweb%[email protected]> > > > > <liftweb%[email protected]<liftweb%[email protected]> > <liftweb%[email protected]<liftweb%[email protected]> > > > > > > > > <liftweb%[email protected]<liftweb%[email protected]> > <liftweb%[email protected]<liftweb%[email protected]> > > > > <liftweb%[email protected]<liftweb%[email protected]> > <liftweb%[email protected]<liftweb%[email protected]> > > > > > > > > > > > > > > . > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/liftweb?hl=en. > > > > > > > > -- > > > > Lift, the simply functional web frameworkhttp://liftweb.net > > > > Beginning Scalahttp://www.apress.com/book/view/1430219890 > > > > Follow me:http://twitter.com/dpp > > > > Surf the harmonics > > > > > > -- > > > 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]<liftweb%[email protected]> > <liftweb%[email protected]<liftweb%[email protected]> > > > > <liftweb%[email protected]<liftweb%[email protected]> > <liftweb%[email protected]<liftweb%[email protected]> > > > > > > > > . > > > For more options, visit this group at > > > http://groups.google.com/group/liftweb?hl=en. > > > > > > > > > > > > -- > > Lift, the simply functional web framework http://liftweb.net > > Beginning Scala http://www.apress.com/book/view/1430219890 > > Follow me: http://twitter.com/dpp > > Surf the harmonics > > > > -- > > 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]<liftweb%[email protected]> > <liftweb%[email protected]<liftweb%[email protected]> > > > > . > > For more options, visit this group at > > http://groups.google.com/group/liftweb?hl=en. > > > > -- > > 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]<liftweb%[email protected]> > <liftweb%[email protected]<liftweb%[email protected]> > > > > . > > For more options, visit this group at > > http://groups.google.com/group/liftweb?hl=en. > > > > > > > -- > Lift, the simply functional web framework http://liftweb.net > Beginning Scala http://www.apress.com/book/view/1430219890 > Follow me: http://twitter.com/dpp > Surf the harmonics > > -- > 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]<liftweb%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. > > -- > 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]<liftweb%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. > > -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics -- 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.
