[Sc-devel] [approve] Deprecation
Scott Wilson
i at scottwilson.ca
Sat Oct 20 12:21:09 PDT 2007
Actually I think it's maybe better as is, since it confirms that the
alternate method exists.
S.
On 19 Oct 2007, at 22:00, Scott Wilson wrote:
> Hmm, like this:
>
> this.deprecated(thisMethod, this.class.findMethod(\play));
> ... continue with method
>
> Alternate method could be in another class. Possibly it's better to
> pass alternate class and method as separate args?
>
> S.
>
> On 19 Oct 2007, at 21:32, Jan Trutzschler wrote:
>
>> so in a deprecated method i would use it like this?
>>
>> playNow{
>> this. deprecated(\playNow, \play)
>> }
>>
>> j.
>>
>> On Oct 19, 2007, at 7:26 PM, Scott Wilson wrote:
>>
>>> I'll commit the following if nobody objects.
>>>
>>> If Error.debug == true if does a stack trace and halts, otherwise
>>> it just posts a warning and continues
>>>
>>> Looks like this:
>>>
>>> DeprecatedError : Error {
>>> var <>receiver;
>>> var <>method, <>class, <>alternateMethod;
>>>
>>> *new { arg receiver, method, alternateMethod, class;
>>> ^super.new(nil, receiver).method_(method).alternateMethod_
>>> (alternateMethod).class_(class)
>>> }
>>> errorString {
>>> ^"ERROR: Method '" ++ method.name ++ "' of class " ++
>>> class.name ++ " is deprecated and will be removed. Use '" ++
>>> alternateMethod.ownerClass ++ ":" ++ alternateMethod.name ++ "'
>>> instead."
>>> }
>>>
>>> reportError {
>>> this.errorString.postln;
>>> }
>>>
>>> throw {
>>> Error.handling = true;
>>> this.reportError;
>>> if (Error.debug) {
>>> this.dumpBackTrace;
>>> Error.handling = false;
>>> this.halt;
>>> } {
>>> Error.handling = false;
>>> };
>>>
>>> }
>>> }
>>>
>>> ... in Object:
>>>
>>> deprecated { arg method, alternateMethod;
>>> DeprecatedError(this, method, alternateMethod, this.class).throw;
>>> }
>>>
>>> Copasetic?
>>>
>>> S.
>>> _______________________________________________
>>> Sc-devel mailing list
>>> Sc-devel at create.ucsb.edu
>>> http://www.create.ucsb.edu/mailman/listinfo/sc-devel
>>
>> _______________________________________________
>> Sc-devel mailing list
>> Sc-devel at create.ucsb.edu
>> http://www.create.ucsb.edu/mailman/listinfo/sc-devel
>
> _______________________________________________
> Sc-devel mailing list
> Sc-devel at create.ucsb.edu
> http://www.create.ucsb.edu/mailman/listinfo/sc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.create.ucsb.edu/pipermail/sc-devel/attachments/20071020/01f8dc41/attachment-0001.htm
More information about the Sc-devel
mailing list