[Cuis] Use of #deprecated: and/or #deprecatedExplanation:

Frank Shearar frank.shearar at gmail.com
Sat Dec 28 05:18:02 CST 2013


That's how they work in Squeak too: Deprecation below is a resumable
Notification:

Object >> deprecated: anExplanationString
    "Warn that the sending method has been deprecated."

    Preferences showDeprecationWarnings ifTrue:
        [Deprecation signal: thisContext sender printString, ' has
been deprecated. ', anExplanationString]


Typically used like this:

Behavior >> compile: code classified: category notifying: requestor
trailer: bytes ifFail: failBlock
    self deprecated: 'Use #compile:notifying:trailer:ifFail:'.
    ^self compile: code notifying: requestor trailer: bytes ifFail: failBlock

frank

On 28 December 2013 02:19, Casey Ransberger <casey.obrien.r at gmail.com> wrote:
> Juan: I believe in Pharo they have deprecation warnings. There's a
> preference to turn them off, and IIRC the first time you hit a deprecated
> method with them enabled, the system complains (can't remember if it's a
> dialog or a debugger or what.)
>
>
> On Fri, Dec 27, 2013 at 6:17 PM, Casey Ransberger <casey.obrien.r at gmail.com>
> wrote:
>>
>> When I do this, I usually do something like
>>
>> self flag: #foo. "Need to remember to take care of foo. --cbr"
>>
>> Main point of saying this is, it's nice to have a comment by the flag so
>> when know who raised it and why.
>>
>>
>> On Fri, Dec 27, 2013 at 2:24 PM, Juan Vuletich <juan at jvuletich.org> wrote:
>>>
>>> On 12/27/2013 3:24 PM, Germán Arduino wrote:
>>>
>>> Hi:
>>>
>>> In Squeak was common the use of #deprecatedExplanation: and also
>>> #deprecate:
>>>
>>> These methods are not present in Cuis, I'm interested in learn how manage
>>> the ports of packages that use de deprecation messages. It's a good practice
>>> use, for example, "self flag: 'comment'"?
>>>
>>> Thanks.
>>>
>>> --
>>> Saludos / Regards,
>>> Germán Arduino
>>> www.arduinosoftware.com
>>>
>>>
>>> We don't have a specific good practice for that... yet. What is the idea?
>>> To let package users know that that method should not be used? What does
>>> that method do in Squeak?
>>>
>>> Cheers,
>>> Juan Vuletich
>>>
>>> _______________________________________________
>>> Cuis mailing list
>>> Cuis at jvuletich.org
>>> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>>>
>>
>
>
> _______________________________________________
> Cuis mailing list
> Cuis at jvuletich.org
> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>




More information about the Cuis mailing list