S.callOnce and S.oneShot (bug or very confusing naming and documentation ?)

115 views
Skip to first unread message

Jon-Anders Teigen

unread,
Jan 26, 2011, 8:12:33 AM1/26/11
to lif...@googlegroups.com
Hi

I ran into an issue with S.callOnce and S.oneShot not behaving the way I was expecting

/**
   * All functions created inside the oneShot scope
   * will only be called once and their results will be
   * cached and served again if the same function is invoked
   */
S.oneShot

this is not correct since the function is not removed until AFTER the function has completed.
The result it that oneShot can be called multiple times

/**
   * If you bind functions (i.e. using SHtml helpers) inside the closure passed to callOnce,
   * after your function is invoked, it will be automatically removed from functions cache so
   * that it cannot be invoked again.
   */
 S.callOnce

this behaves according to the documentation as the function is removed after the invocation.
But since the method is called "callOnce" one could easily be lead to believe that it would only be called only once


I put up a small example demonstrating the issue

Best Regards

Jon-Anders

David Pollak

unread,
Jan 26, 2011, 9:06:26 AM1/26/11
to lif...@googlegroups.com
Please open a ticket at http://ticket.liftweb.net (you must be a watcher of the Liftweb space to open tickets).

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
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
Blog: http://goodstuff.im
Surf the harmonics

Jon-Anders Teigen

unread,
Jan 26, 2011, 12:16:26 PM1/26/11
to lif...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages