|
Re: Passing an environment around: msg#00018lang.haskell.general
On 27-Oct-2000, José Romildo Malaquias <romildo@xxxxxxxxxxxxxxxxxx> wrote: > On Fri, Oct 27, 2000 at 09:07:24AM -0700, Jeffrey R. Lewis wrote: > > Yes, as implemented using the dictionary > > translation, implicit parameterization can lead to loss of sharing, exactly > > in > > the same way that overloading (and HOF in general) can lead to loss of > > sharing. > > > > However, I can imagine that a compiler might chose to implement implicit > > parameters more like dynamic variables in lisp. Each implicit param > > essentially > > becomes a global variable, implemented as a stack of values - the top of the > > stack is the value currently in scope. This would avoid the sharing problem > > nicely. > > I suppose your implementation of implicit parameterization in GHC and Hugs > uses the dictionary translation, right? I believe so. > Would an alternative implementation > based on a stack of values be viable Yes. > and even done? Unlikely ;-) > Does it have serious drawbacks when compared with the > dictionary translation technique? In the form described by Jeff Lewis above, yes, it does: it's not thread-safe. An alternative is to store the values of the implicit parameters in thread-local storage rather than global storage. But this is more complicated. It may also be less efficient on some targets (depending on how efficiently thread-local storage is implemented). -- Fergus Henderson <fjh@xxxxxxxxxxx> | "I have always known that the pursuit | of excellence is a lethal habit" WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp. |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: First class modules: 00018, Fergus Henderson |
|---|---|
| Next by Date: | Re: Passing an environment around: 00018, Jeffrey R. Lewis |
| Previous by Thread: | ANNOUNCE: hdirect-0.17i: 00018, Sigbjorn Finne |
| Next by Thread: | Re: Passing an environment around: 00018, Jeffrey R. Lewis |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |