and here's a port to closures...
On Thu, Jul 22, 2010 at 10:39 AM, Eliot Miranda <[email protected]>wrote: > > > 2010/7/22 Sudhakar Krishnamachari <[email protected]> > > And of course the extensibility it gives: >> >> [ 1->'asd'. 2->'asd'. 3->'dsd' ] asDictionary >> > > I think Travis Griggs' once is much much nicer: > > [{ 1->'asd'. 2->'asd'. 3->'dsd' } asDictionary] once > > when once is sent to a BlockClosure it becomes itself into a > CachedBlockClosure that remembers and answers the evaluated value. > You could add selectors to this such as > onceEachSession - destroy the cached value on image startup > > It doesn't require any special compiler machinery (unlike ##(...)) and so > there are no problems with browsing references or senders within > compile-time evaluated forms. It is easily extensible to different > life-times. It is portable. > > my 2¢ > > Eliot > >> >> ... >> >> >> On Thu, Jul 22, 2010 at 7:48 PM, Sudhakar Krishnamachari < >> [email protected]> wrote: >> >>> * >>> *>* > It's different because evaluated only once, either at method >>> compilation >>> >>> *>* or at first execution (lazy initialization). >>> * >>> >>> >> >> _______________________________________________ >> Pharo-project mailing list >> [email protected] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> > >
once.st
Description: Binary data
_______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
