David E Jones wrote: > On Jan 30, 2010, at 7:28 PM, Adam Heath wrote: >> When I originally came up with the read-only generics for service >> engine calls, I tried to make the maps writable. But upon modifying >> the entire stack, I discovered it wasn't possible. The service engine >> made copies in some cases, so the underlying service implementations >> weren't able to send data back at all to the original caller. To >> encapsulate this, I made the map read only, by using the ? extends syntax. > > Maybe this is not the best way to look at it. The point is not that you can't > change the context, it is just that any changes to the context are local to > the service itself.
Well, if people start modifying the passed in context, and they assume that those changes will cascade out, then they will become very confused when that's not the case. You'll also find that most services implementations don't need to modify the context. You are correct for those that do, they consider it as a local variable store. > If I had the service engine to design again I'd consider having it be more > like the screen widget with the hierarchical context, and with the context as > the local variable space (for all services except those written in plain Java > where you can't inject into the variable space on the stack (not that I know > of anyway... maybe there is a way and that would be cool).