Hello, My "problem": the user types in the ccw's editor. Each time she types, there's an opportunity to reparse the editor's content. But the reparse is not always necessary, especially when the types a symbol.
So I could use a delay to only force the repase "on-demand". On the other end, when the user stops typing for a while (say 500 ms), it could be interesting to automatically trigger a reparse, so that the next editor command implying a "fresh parsetree" seems to be instantaneous. So I could use a "delayed future". A future which would do nothing the first n milliseconds (eg n = 500 ms), and then do its job. But I can't use a "classic" future, 'cause I want the deref of this "delayed future" to bypass the pause. Is there an classical idiom for this ? Here is what I've come up in my head : * create a datastructure with 2 fields, one holding a future, one holding a delay. the future will "wait" for n millisecs, and then force the delay. * The datastructure will accept the future API and delegate all calls to the future,*except* for the deref call which will bypass the future and deref the delay instead What do you think ? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en