deprecating classes

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

deprecating classes

Peter Uhnak
Hi,

is there a mechanism for deprecating whole classes?

For example there's class RTResizEable that has been replaced by RTResizable (without extra "e") class. But if I don't want to break people's code I would like to tell them that they should use something else.

I could mark every method with "self deprecated:" but that's a bit tedious...
And doing it with a script (rewritting all methods to add the statement) is dangerous, because it can be part of UI loop, so it will blow up the image with warnings.

An idea might be to instead of opening Warning dialog with debug...
to create a "Deprecations Browser" (which has only one instance so if you attempt to open it again while it is still opened nothing will happen).
And in the Deprecations Browser would be list of triggered deprecations... maybe something like "Announcements tab" in Announcer inspector...

That way even deprecations in UI loops will just add a hundred rows to a single window instead of opening hundred windows. (And there would be also opportunity for not showing duplicates.)

Thanks,
Peter
Reply | Threaded
Open this post in threaded view
|

Re: deprecating classes

Mariano Martinez Peck
In the past I have done a few hacks...one was to remove all methods from the class and only implement #doesNotUnderstand: calling the deprecation method saying the class was deprecated and now you should use xxxx.

In another case, I didn't want to remove methods from the class for some other reason, so if I remember correct I hacked it but doing a Smalltalk at: #MyClass put:  self createDeprecatedClass.

And #createDeprecatedClass would create a dummy class with no method but the mentioned dnu...

But for sure we need a better way to deprecate classes and packages too!



On Fri, Jul 24, 2015 at 11:31 AM, Peter Uhnák <[hidden email]> wrote:
Hi,

is there a mechanism for deprecating whole classes?

For example there's class RTResizEable that has been replaced by RTResizable (without extra "e") class. But if I don't want to break people's code I would like to tell them that they should use something else.

I could mark every method with "self deprecated:" but that's a bit tedious...
And doing it with a script (rewritting all methods to add the statement) is dangerous, because it can be part of UI loop, so it will blow up the image with warnings.

An idea might be to instead of opening Warning dialog with debug...
to create a "Deprecations Browser" (which has only one instance so if you attempt to open it again while it is still opened nothing will happen).
And in the Deprecations Browser would be list of triggered deprecations... maybe something like "Announcements tab" in Announcer inspector...

That way even deprecations in UI loops will just add a hundred rows to a single window instead of opening hundred windows. (And there would be also opportunity for not showing duplicates.)

Thanks,
Peter



--