On Apr 12, 2010, at 4:17 11PM, Igor Stasenko wrote:

> Hello,
> 
> i attempted to load Alien-Core package into trunk image, and it failed.
> 
> One of the problem is override of recreateSpecialObjectsArray method..
> 
> I wonder, maybe we should design a nicer API for extending/reserving
> slots in special objects array,
> so it won't require overriding this method by every package which
> needs to extend special objects, like FFI or Alien.
> 
> Another aspect of replacing this method is , that it makes problematic
> to unload such package, in case one wants to unload it.
> 
> So, my proposal is to add a simple API to SmalltalkImage class, and in
> order to install additional special objects one should do like:
> 
> MyClass class>>initialize
> 
> Smalltalk registerSpecialObject: myObject at: 55.
> Smalltalk registerSpecialObject: myObject at: 56.
> ...
> 
> or:
> 
> Smalltalk registerSpecialObjects: #( x y z) startingAt: 56.
> 
> upon package unload, a reverse scheme should be supported:
> 
> 
> MyClass class>>unload
> 
> Smalltalk unregisterSpecialObjectAt: 55.
> Smalltalk unregisterSpecialObjectAt: 56.
> ...
> 
> or:
> 
> Smalltalk unregisterSpecialObjects: 3 startingAt: 56.
> 
> 
> what you think?
> 
> -- 
> Best regards,
> Igor Stasenko AKA sig.
> 

+1 for the overall idea.
Implementation-wise, I'd also vote for raising errors in 
registerSpecialObject:at: if something other than myObject is already 
registered, changing to unregisterSpecialObject: at: in order to not 
unintentionally unregistering something else, and disallow 
unregisterSpecialObjects:startingAt: ;)

Cheers,
Henry


_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to