On 27 Nov., 04:33, pmf <[email protected]> wrote: > On Nov 26, 7:39 pm, Richard Newman <[email protected]> wrote: > > > "Re consistency: I seem to recall Pascal Costanza working on > > activation of layers, so you can swap a whole set of stuff across your > > program. He spoke about it at ILC2009, but I'm not sure I've found the > > right paper. Common Lisp-specific, though." > > > He showed a website, paused mid-request, where he swapped out several > > functions. Unpausing the request still ran to completion with the old > > functions. A new request ran with the new functions. Impressive. > > CLOS and the MOP allows you to change a class and have all already > existing instances be transformed into the new form (in an automatic > or user defined way), which makes these things much easier to achieve > than in Java- and Clojure-world.
I think there is a misunderstanding here. Clojure makes it easy to update state, and a MOP is not needed. But I am not talking about adding/removing slots to an object, but instead of modifying *functions*. Let‘s say we have the functions A, B, C, D, E, F and G. A is calling B, B is calling C, C is calling D, and so on. Now a request R1 comes in, function A is called and this chain continues to, say, E. Now a reload happens. Some functions A-G are changed. B now may expect C to return not a value v1, but instead a vector of the values [v1 v2]. Even if the signatures didn‘t change and no exception would be thrown, it could destroy consistency of the data anyway. What I want is that any request R1, R2, R3, ... will continue to use the chain A-G. A reload should happen atomically. All functions should load and eval in the background and only become callable if everything was reloaded. All new incoming requests will now go through the new chain A-G (maybe some new functions came in and it is now A-Z, or others were removed so that it will be A-Z but without D and E) while at the same time R1 continues with the old set of functions. That way each user of (my) web services would get a constintent answer. Some users may be in a session that can go for minutes or hours or even days. In such a case we may be interested that as long this session exists this users requests will always be handled with the old set of functions. So, a way to make a “namespace snapshot” would be interesting. Each time when a request comes in one can snapshot the code, and only then begin to handle the request. If a session gets created one can store the snapshoted functions in the session object and read it out of there. I don‘t know if this makes sense and what problems may arise, and even if such a proposal sounds nice in theory it may be too hard to develop, for now. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
