Re: JavaMemberNode optimisation
"Mark S. Miller" <[email protected]>
| Newsgroups | gmane.comp.lang.e.general |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Dec 13, 2010 at 5:39 AM, Kevin Reid <kpreid-M/[email protected]> wrote: > On Dec 13, 2010, at 5:58, Thomas Leonard wrote: > > > This change caused a slight side-effect: causeway does this: > > > > def editorShellListener :ShellListener := def _ { ... } > > > > editorShell.addShellListener(editorShellListener) > > ... > > editorShell.removeShellListener(editorShellListener) > > > > This relies on editorShellListener being the same (deflector) object > > each time. However, E.as always unwraps the deflector and creates a > > new > > one. > > > (Note that as a general invariant, it must be impossible to > distinguish between objects which are considered the same by > Equalizer. Deflectors and resolved promises are both wrappers that can > cause trouble in these cases.) > > Merely avoiding making a new deflector would still result in this > being a problem: > > def editorShellListener := def _ { ... } > editorShell.addShellListener(editorShellListener :ShellListener) > editorShell.removeShellListener(editorShellListener :ShellListener) > > since a deflector is constructed twice. > > The fix which comes to mind is to use a weak table to ensure that > there is at most one deflector for each combination of E-object and > Java interface. > I like the weak table idea. The resulting system has strictly less odd semantics than any of the alternatives. > > Or, we could make Deflectors not considered E-same as their referents; > this would be safe since it happens at the moment of explicit > coercion, but less transparent. > > -- > Kevin Reid <http://switchb.org/kpreid/> > > _______________________________________________ > e-lang mailing list > [email protected] > http://www.eros-os.org/mailman/listinfo/e-lang > -- Cheers, --MarkM _______________________________________________ e-lang mailing list [email protected] http://www.eros-os.org/mailman/listinfo/e-lang