finds replacements for deprecated objects

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

finds replacements for deprecated objects

Steve Quezadas
Forgive the naive question here. But if an object gets deprecated, how do you find the closest replacement object in Pharo? Is there a way to do it within the VM or do you just have to check the documentation?

- Steve

Reply | Threaded
Open this post in threaded view
|

Re: finds replacements for deprecated objects

Ben Coman
On Thu, 15 Aug 2019 at 09:37, Steve Quezadas <[hidden email]> wrote:
Forgive the naive question here. But if an object gets deprecated, how do you find the closest replacement object in Pharo? Is there a way to do it within the VM or do you just have to check the documentation?

Hi Steve,

First I just like to check the language you're using.  The usual discussion I see about deprecation relates to "classes" that define the objects rather than the "objects" themselves.
Do you mean "if a class gets deprecated?"

Also the "VM" is compiled with a C-compiler (gcc or clang) and not code that most Pharo users will ever look at.
Different to other languages (e.g. Java), the Pharo VM contains only low-level routines for memory-manipulation, bytecode-execution and a few primitives for interfacing different operating systems libraries. 
90% of Pharo library code is stored "within the Image" that runs on top of the VM.

So if you want to find the replacement for SomeDeprecatedClass that your application is using, 
a bit of investigation in the old Image should be able to discover places its being used in the default Pharo libraries,
the look at those same places in the latest Image and see which class they are now using.
Two useful tools for that in SystemBrowser are:
  1. Right-click a class and choose "Analyse > Class refs"
  2. Right-click a method and choose "Senders"

Pharo also has some facilities for creation of deprecation-rules to automatically identify deprecation-use by your code and suggest the replacement.
Whether those have been written for the particular thing you are interested in is another question.  
Do you have a particular class or method in mind? And which versions of Pharo are you considering?

cheers -ben