[Lift] Re: How to share request scope data among snippets in Lift
On Tue, Oct 6, 2009 at 12:01 AM, Kevin Wright kev.lee.wri...@googlemail.com wrote: On Mon, Oct 5, 2009 at 10:54 PM, Jack Widman jack.wid...@gmail.com wrote: I'm not sure English is Turing Complete. Also not sure how prominent it will be in 50 years ... :) Nor I, but I'm certain that Turing was (Queen's) English complete... :) Didn't the Queen's England like have him castrated for being homosexual as well? http://en.wikipedia.org/wiki/Alan_Turing#Conviction_for_gross_indecency On Mon, Oct 5, 2009 at 5:51 PM, David Pollak feeder.of.the.be...@gmail.com wrote: On Mon, Oct 5, 2009 at 9:35 AM, Timothy Perrett timo...@getintheloop.eu wrote: Call me old fashioned, but good ol' English seems to be quite prevalent these days ;-) Is this the Queen's English? ;-) On 5 Oct 2009, at 17:02, Jack Widman wrote: Why don't we make Esperanto the official Lift language? -- 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 -- Jack -- Viktor Klang Blog: klangism.blogspot.com Twttr: viktorklang Lift Committer - liftweb.com AKKA Committer - akkasource.org Cassidy - github.com/viktorklang/Cassidy.git SoftPub founder: http://groups.google.com/group/softpub --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: How to share request scope data among snippets in Lift
On Sun, Oct 4, 2009 at 2:41 AM, ishiijp yoshinori.is...@gmail.com wrote: Thank you for your example, David. It will work in my purpose. Cool. It seems that my poor English and less information let some people confused. I appreciate that you have put in the work to translate your thoughts to English. I apologize that I only speak English, but would love to speak Japanese, German, Russian, and a few other languages. I need just a request scope data. It means I want to share information between snippets across a request. (Is the expression request scope not good for in this case...?) request scope is exactly the right phrase. Thank all responsed my post, and your suggestions are informative. I think very nice community is here. On 9月26日, 午後10:33, David Pollak feeder.of.the.be...@gmail.com wrote: To share information between snippets during a request, use a RequestVar: object MyInfo extends RequestVar(calculate_value) so object MyInfo extends RequestVar[Box[Invoice]](Empty) in one snippet, you may calculate the Invoice and put it in the MyInfo: MyInfo.set(Full(invoice)) In another snippet, you can extract: for { invoice - MyInfo.is } yield ... Note that the calculate_value is a call-by-name parameter, so it will be invoked each time the RequestVar is uninitialized. You can place lazy calculation logic in here. On Sat, Sep 26, 2009 at 12:14 AM, ishiijp yoshinori.is...@gmail.com wrote: Hi. If my lift application have some data that cost to create, and I want to share it among snippets, how to do in Lift? if such data are shared inside one snippet, I may use lazy val. But I have no nice idea to share it among different snippts. Thanks much. -- 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 -- 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 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 -~--~~~~--~~--~--~---
[Lift] Re: How to share request scope data among snippets in Lift
On Oct 5, 6:15 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On Sun, Oct 4, 2009 at 2:41 AM, ishiijp yoshinori.is...@gmail.com wrote: Thank you for your example, David. It will work in my purpose. Cool. It seems that my poor English and less information let some people confused. I appreciate that you have put in the work to translate your thoughts to English. I apologize that I only speak English, but would love to speak Japanese, German, Russian, and a few other languages. oh you gotta learn Romanian :) I need just a request scope data. It means I want to share information between snippets across a request. (Is the expression request scope not good for in this case...?) request scope is exactly the right phrase. Thank all responsed my post, and your suggestions are informative. I think very nice community is here. On 9月26日, 午後10:33, David Pollak feeder.of.the.be...@gmail.com wrote: To share information between snippets during a request, use a RequestVar: object MyInfo extends RequestVar(calculate_value) so object MyInfo extends RequestVar[Box[Invoice]](Empty) in one snippet, you may calculate the Invoice and put it in the MyInfo: MyInfo.set(Full(invoice)) In another snippet, you can extract: for { invoice - MyInfo.is } yield ... Note that the calculate_value is a call-by-name parameter, so it will be invoked each time the RequestVar is uninitialized. You can place lazy calculation logic in here. On Sat, Sep 26, 2009 at 12:14 AM, ishiijp yoshinori.is...@gmail.com wrote: Hi. If my lift application have some data that cost to create, and I want to share it among snippets, how to do in Lift? if such data are shared inside one snippet, I may use lazy val. But I have no nice idea to share it among different snippts. Thanks much. -- 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 -- 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 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 -~--~~~~--~~--~--~---
[Lift] Re: How to share request scope data among snippets in Lift
Why don't we make Esperanto the official Lift language? On Mon, Oct 5, 2009 at 11:52 AM, marius d. marius.dan...@gmail.com wrote: On Oct 5, 6:15 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On Sun, Oct 4, 2009 at 2:41 AM, ishiijp yoshinori.is...@gmail.com wrote: Thank you for your example, David. It will work in my purpose. Cool. It seems that my poor English and less information let some people confused. I appreciate that you have put in the work to translate your thoughts to English. I apologize that I only speak English, but would love to speak Japanese, German, Russian, and a few other languages. oh you gotta learn Romanian :) I need just a request scope data. It means I want to share information between snippets across a request. (Is the expression request scope not good for in this case...?) request scope is exactly the right phrase. Thank all responsed my post, and your suggestions are informative. I think very nice community is here. On 9月26日, 午後10:33, David Pollak feeder.of.the.be...@gmail.com wrote: To share information between snippets during a request, use a RequestVar: object MyInfo extends RequestVar(calculate_value) so object MyInfo extends RequestVar[Box[Invoice]](Empty) in one snippet, you may calculate the Invoice and put it in the MyInfo: MyInfo.set(Full(invoice)) In another snippet, you can extract: for { invoice - MyInfo.is } yield ... Note that the calculate_value is a call-by-name parameter, so it will be invoked each time the RequestVar is uninitialized. You can place lazy calculation logic in here. On Sat, Sep 26, 2009 at 12:14 AM, ishiijp yoshinori.is...@gmail.com wrote: Hi. If my lift application have some data that cost to create, and I want to share it among snippets, how to do in Lift? if such data are shared inside one snippet, I may use lazy val. But I have no nice idea to share it among different snippts. Thanks much. -- 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 -- 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 -- Jack --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: How to share request scope data among snippets in Lift
On Mon, Oct 5, 2009 at 6:02 PM, Jack Widman jack.wid...@gmail.com wrote: Why don't we make Esperanto the official Lift language? I'd say make Scala the official language ;) On Mon, Oct 5, 2009 at 11:52 AM, marius d. marius.dan...@gmail.comwrote: On Oct 5, 6:15 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On Sun, Oct 4, 2009 at 2:41 AM, ishiijp yoshinori.is...@gmail.com wrote: Thank you for your example, David. It will work in my purpose. Cool. It seems that my poor English and less information let some people confused. I appreciate that you have put in the work to translate your thoughts to English. I apologize that I only speak English, but would love to speak Japanese, German, Russian, and a few other languages. oh you gotta learn Romanian :) I need just a request scope data. It means I want to share information between snippets across a request. (Is the expression request scope not good for in this case...?) request scope is exactly the right phrase. Thank all responsed my post, and your suggestions are informative. I think very nice community is here. On 9月26日, 午後10:33, David Pollak feeder.of.the.be...@gmail.com wrote: To share information between snippets during a request, use a RequestVar: object MyInfo extends RequestVar(calculate_value) so object MyInfo extends RequestVar[Box[Invoice]](Empty) in one snippet, you may calculate the Invoice and put it in the MyInfo: MyInfo.set(Full(invoice)) In another snippet, you can extract: for { invoice - MyInfo.is } yield ... Note that the calculate_value is a call-by-name parameter, so it will be invoked each time the RequestVar is uninitialized. You can place lazy calculation logic in here. On Sat, Sep 26, 2009 at 12:14 AM, ishiijp yoshinori.is...@gmail.com wrote: Hi. If my lift application have some data that cost to create, and I want to share it among snippets, how to do in Lift? if such data are shared inside one snippet, I may use lazy val. But I have no nice idea to share it among different snippts. Thanks much. -- 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 -- 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 -- Jack -- Viktor Klang Blog: klangism.blogspot.com Twttr: viktorklang Lift Committer - liftweb.com AKKA Committer - akkasource.org Cassidy - github.com/viktorklang/Cassidy.git SoftPub founder: http://groups.google.com/group/softpub --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: How to share request scope data among snippets in Lift
Well it is high enough level! [?] On Mon, Oct 5, 2009 at 3:49 PM, Viktor Klang viktor.kl...@gmail.com wrote: On Mon, Oct 5, 2009 at 6:02 PM, Jack Widman jack.wid...@gmail.com wrote: Why don't we make Esperanto the official Lift language? I'd say make Scala the official language ;) On Mon, Oct 5, 2009 at 11:52 AM, marius d. marius.dan...@gmail.comwrote: On Oct 5, 6:15 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On Sun, Oct 4, 2009 at 2:41 AM, ishiijp yoshinori.is...@gmail.com wrote: Thank you for your example, David. It will work in my purpose. Cool. It seems that my poor English and less information let some people confused. I appreciate that you have put in the work to translate your thoughts to English. I apologize that I only speak English, but would love to speak Japanese, German, Russian, and a few other languages. oh you gotta learn Romanian :) I need just a request scope data. It means I want to share information between snippets across a request. (Is the expression request scope not good for in this case...?) request scope is exactly the right phrase. Thank all responsed my post, and your suggestions are informative. I think very nice community is here. On 9月26日, 午後10:33, David Pollak feeder.of.the.be...@gmail.com wrote: To share information between snippets during a request, use a RequestVar: object MyInfo extends RequestVar(calculate_value) so object MyInfo extends RequestVar[Box[Invoice]](Empty) in one snippet, you may calculate the Invoice and put it in the MyInfo: MyInfo.set(Full(invoice)) In another snippet, you can extract: for { invoice - MyInfo.is } yield ... Note that the calculate_value is a call-by-name parameter, so it will be invoked each time the RequestVar is uninitialized. You can place lazy calculation logic in here. On Sat, Sep 26, 2009 at 12:14 AM, ishiijp yoshinori.is...@gmail.com wrote: Hi. If my lift application have some data that cost to create, and I want to share it among snippets, how to do in Lift? if such data are shared inside one snippet, I may use lazy val. But I have no nice idea to share it among different snippts. Thanks much. -- 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 -- 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 -- Jack -- Viktor Klang Blog: klangism.blogspot.com Twttr: viktorklang Lift Committer - liftweb.com AKKA Committer - akkasource.org Cassidy - github.com/viktorklang/Cassidy.git SoftPub founder: http://groups.google.com/group/softpub -- Jack --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~--- inline: 330.gif
[Lift] Re: How to share request scope data among snippets in Lift
I was about to offer a smattering of Greek, Swedish and Hungarian (don't ask...) But scala has to take the prize, I wonder if we couldn't implement lojban as a DSL? :) On Mon, Oct 5, 2009 at 8:49 PM, Viktor Klang viktor.kl...@gmail.com wrote: On Mon, Oct 5, 2009 at 6:02 PM, Jack Widman jack.wid...@gmail.com wrote: Why don't we make Esperanto the official Lift language? I'd say make Scala the official language ;) On Mon, Oct 5, 2009 at 11:52 AM, marius d. marius.dan...@gmail.com wrote: On Oct 5, 6:15 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On Sun, Oct 4, 2009 at 2:41 AM, ishiijp yoshinori.is...@gmail.com wrote: Thank you for your example, David. It will work in my purpose. Cool. It seems that my poor English and less information let some people confused. I appreciate that you have put in the work to translate your thoughts to English. I apologize that I only speak English, but would love to speak Japanese, German, Russian, and a few other languages. oh you gotta learn Romanian :) I need just a request scope data. It means I want to share information between snippets across a request. (Is the expression request scope not good for in this case...?) request scope is exactly the right phrase. Thank all responsed my post, and your suggestions are informative. I think very nice community is here. On 9月26日, 午後10:33, David Pollak feeder.of.the.be...@gmail.com wrote: To share information between snippets during a request, use a RequestVar: object MyInfo extends RequestVar(calculate_value) so object MyInfo extends RequestVar[Box[Invoice]](Empty) in one snippet, you may calculate the Invoice and put it in the MyInfo: MyInfo.set(Full(invoice)) In another snippet, you can extract: for { invoice - MyInfo.is } yield ... Note that the calculate_value is a call-by-name parameter, so it will be invoked each time the RequestVar is uninitialized. You can place lazy calculation logic in here. On Sat, Sep 26, 2009 at 12:14 AM, ishiijp yoshinori.is...@gmail.com wrote: Hi. If my lift application have some data that cost to create, and I want to share it among snippets, how to do in Lift? if such data are shared inside one snippet, I may use lazy val. But I have no nice idea to share it among different snippts. Thanks much. -- 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 -- 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 -- Jack -- Viktor Klang Blog: klangism.blogspot.com Twttr: viktorklang Lift Committer - liftweb.com AKKA Committer - akkasource.org Cassidy - github.com/viktorklang/Cassidy.git SoftPub founder: http://groups.google.com/group/softpub --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: How to share request scope data among snippets in Lift
Call me old fashioned, but good ol' English seems to be quite prevalent these days ;-) On 5 Oct 2009, at 17:02, Jack Widman wrote: Why don't we make Esperanto the official Lift language? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: How to share request scope data among snippets in Lift
On Mon, Oct 5, 2009 at 9:35 AM, Timothy Perrett timo...@getintheloop.euwrote: Call me old fashioned, but good ol' English seems to be quite prevalent these days ;-) Is this the Queen's English? ;-) On 5 Oct 2009, at 17:02, Jack Widman wrote: Why don't we make Esperanto the official Lift language? -- 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 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 -~--~~~~--~~--~--~---
[Lift] Re: How to share request scope data among snippets in Lift
I'm not sure English is Turing Complete. Also not sure how prominent it will be in 50 years ... :) On Mon, Oct 5, 2009 at 5:51 PM, David Pollak feeder.of.the.be...@gmail.comwrote: On Mon, Oct 5, 2009 at 9:35 AM, Timothy Perrett timo...@getintheloop.euwrote: Call me old fashioned, but good ol' English seems to be quite prevalent these days ;-) Is this the Queen's English? ;-) On 5 Oct 2009, at 17:02, Jack Widman wrote: Why don't we make Esperanto the official Lift language? -- 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 -- Jack --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: How to share request scope data among snippets in Lift
On Mon, Oct 5, 2009 at 10:54 PM, Jack Widman jack.wid...@gmail.com wrote: I'm not sure English is Turing Complete. Also not sure how prominent it will be in 50 years ... :) Nor I, but I'm certain that Turing was (Queen's) English complete... :) On Mon, Oct 5, 2009 at 5:51 PM, David Pollak feeder.of.the.be...@gmail.com wrote: On Mon, Oct 5, 2009 at 9:35 AM, Timothy Perrett timo...@getintheloop.eu wrote: Call me old fashioned, but good ol' English seems to be quite prevalent these days ;-) Is this the Queen's English? ;-) On 5 Oct 2009, at 17:02, Jack Widman wrote: Why don't we make Esperanto the official Lift language? -- 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 -- Jack --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: How to share request scope data among snippets in Lift
Only the Queen speaks the queens english - your average schmuck on this isle can only just about manage to string together a sentence! HAHA. Cheers, Tim On 5 Oct 2009, at 22:51, David Pollak wrote: On Mon, Oct 5, 2009 at 9:35 AM, Timothy Perrett timo...@getintheloop.eu wrote: Call me old fashioned, but good ol' English seems to be quite prevalent these days ;-) Is this the Queen's English? ;-) On 5 Oct 2009, at 17:02, Jack Widman wrote: Why don't we make Esperanto the official Lift language? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: How to share request scope data among snippets in Lift
Thank you for your example, David. It will work in my purpose. It seems that my poor English and less information let some people confused. I need just a request scope data. It means I want to share information between snippets across a request. (Is the expression request scope not good for in this case...?) Thank all responsed my post, and your suggestions are informative. I think very nice community is here. On 9月26日, 午後10:33, David Pollak feeder.of.the.be...@gmail.com wrote: To share information between snippets during a request, use a RequestVar: object MyInfo extends RequestVar(calculate_value) so object MyInfo extends RequestVar[Box[Invoice]](Empty) in one snippet, you may calculate the Invoice and put it in the MyInfo: MyInfo.set(Full(invoice)) In another snippet, you can extract: for { invoice - MyInfo.is } yield ... Note that the calculate_value is a call-by-name parameter, so it will be invoked each time the RequestVar is uninitialized. You can place lazy calculation logic in here. On Sat, Sep 26, 2009 at 12:14 AM, ishiijp yoshinori.is...@gmail.com wrote: Hi. If my lift application have some data that cost to create, and I want to share it among snippets, how to do in Lift? if such data are shared inside one snippet, I may use lazy val. But I have no nice idea to share it among different snippts. Thanks much. -- 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 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 -~--~~~~--~~--~--~---
[Lift] Re: How to share request scope data among snippets in Lift
If the information is created just once and then used across multiple requests, it'll be a lazy val in a singleton If it's request-dependent then it'll be a singleton extending RequestVar Sadly, the OP didn't specify what was needed :( On Sat, Sep 26, 2009 at 2:35 PM, Timothy Perrett timo...@getintheloop.eu wrote: Take a look at RequestVar... If he were to just use a object singleton he might end up being not thread safe. Cheers Tim Sent from my iPhone On 26 Sep 2009, at 14:05, Kevin Wright kev.lee.wri...@googlemail.com wrote: You could always try putting your lazy val inside a singleton object On Sat, Sep 26, 2009 at 8:14 AM, ishiijp yoshinori.is...@gmail.com wrote: Hi. If my lift application have some data that cost to create, and I want to share it among snippets, how to do in Lift? if such data are shared inside one snippet, I may use lazy val. But I have no nice idea to share it among different snippts. Thanks much. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: How to share request scope data among snippets in Lift
You could always try putting your lazy val inside a singleton object On Sat, Sep 26, 2009 at 8:14 AM, ishiijp yoshinori.is...@gmail.com wrote: Hi. If my lift application have some data that cost to create, and I want to share it among snippets, how to do in Lift? if such data are shared inside one snippet, I may use lazy val. But I have no nice idea to share it among different snippts. Thanks much. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: How to share request scope data among snippets in Lift
On Sat, Sep 26, 2009 at 2:54 PM, David Pollak feeder.of.the.be...@gmail.com wrote: On Sat, Sep 26, 2009 at 6:40 AM, Kevin Wright kev.lee.wri...@googlemail.com wrote: If the information is created just once and then used across multiple requests, it'll be a lazy val in a singleton A lazy val in a singleton will not work. Once it's calculated, it's calculated and cannot be changed for the life of the singleton. If the singleton is global scope, you're really hosed. RequestVars are the Lift way of sharing information across snippets on a request-by-request basis. If you want lazy evaluation of the RequestVar: object Invoice extends RequestVar(S.param(invoice_id).flatMap(id = Invoice.find(id))) // type inferred to Box[Invoice] If you want to share information across the scope of your session, use a SessionVar. SessionVar works exactly like RequestVar, but the lifespan of the SessionVar is your session. The OP never actually stated share between snippets across a session or share between snippets across a request. It was simply share between snippets Almost certainly SessionVar or RequestVar are what will be needed, but what if the data is truly global in nature? Something like the 2001 average world exchange rates vs USD, which requires a costly webservice or database lookup to find. The original request was vague, but global caching is definitely one possible interpretation of what was wanted. If it's request-dependent then it'll be a singleton extending RequestVar Sadly, the OP didn't specify what was needed :( On Sat, Sep 26, 2009 at 2:35 PM, Timothy Perrett timo...@getintheloop.eu wrote: Take a look at RequestVar... If he were to just use a object singleton he might end up being not thread safe. Cheers Tim Sent from my iPhone On 26 Sep 2009, at 14:05, Kevin Wright kev.lee.wri...@googlemail.com wrote: You could always try putting your lazy val inside a singleton object On Sat, Sep 26, 2009 at 8:14 AM, ishiijp yoshinori.is...@gmail.com wrote: Hi. If my lift application have some data that cost to create, and I want to share it among snippets, how to do in Lift? if such data are shared inside one snippet, I may use lazy val. But I have no nice idea to share it among different snippts. Thanks much. -- 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 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 -~--~~~~--~~--~--~---
[Lift] Re: How to share request scope data among snippets in Lift
On Sat, Sep 26, 2009 at 6:40 AM, Kevin Wright kev.lee.wri...@googlemail.com wrote: If the information is created just once and then used across multiple requests, it'll be a lazy val in a singleton A lazy val in a singleton will not work. Once it's calculated, it's calculated and cannot be changed for the life of the singleton. If the singleton is global scope, you're really hosed. RequestVars are the Lift way of sharing information across snippets on a request-by-request basis. If you want lazy evaluation of the RequestVar: object Invoice extends RequestVar(S.param(invoice_id).flatMap(id = Invoice.find(id))) // type inferred to Box[Invoice] If you want to share information across the scope of your session, use a SessionVar. SessionVar works exactly like RequestVar, but the lifespan of the SessionVar is your session. If it's request-dependent then it'll be a singleton extending RequestVar Sadly, the OP didn't specify what was needed :( On Sat, Sep 26, 2009 at 2:35 PM, Timothy Perrett timo...@getintheloop.eu wrote: Take a look at RequestVar... If he were to just use a object singleton he might end up being not thread safe. Cheers Tim Sent from my iPhone On 26 Sep 2009, at 14:05, Kevin Wright kev.lee.wri...@googlemail.com wrote: You could always try putting your lazy val inside a singleton object On Sat, Sep 26, 2009 at 8:14 AM, ishiijp yoshinori.is...@gmail.com wrote: Hi. If my lift application have some data that cost to create, and I want to share it among snippets, how to do in Lift? if such data are shared inside one snippet, I may use lazy val. But I have no nice idea to share it among different snippts. Thanks much. -- 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 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 -~--~~~~--~~--~--~---