Hannes You are certainly not required to eliminate #name altogether; all you have to do is to ensure that any object that receives the message #name knows how to answer its own name in an appropriate way. To rephrase Benâs second para in a more long-winded way: a. Run the code that generates the deprecation warning. b. In the warning pop-up, click on âDebugâ. c. Examine the debug stack in the top pane. It is probable that the first two lines will read: HannesClass(Object) deprecated:on:in HannesClass(Object) name where HannesClass is the name of some class in your domain model. d. You now know that some code you have written is sending the message #name to an instance of HannesClass, but the class does not have such a method. The solution is to decide how an instance of that class should answer its name, and implement that as a method on the instance side of that class. If nothing else is obvious, the usual default is ^self printString. e. If the top line of the debug stack does not refer to a class in your model, work your way down the stack until you find a class that is yours. Hope this helps Peter Kenny From: Pharo-users [mailto:pharo-users-bounces@lists.pharo.org] On Behalf Of Ben Coman Sent: 26 August 2017 13:08 To: Any question about pharo is welcome <pharo-users@lists.pharo.org> Subject: Re: [Pharo-users] Object>>#name deprecated in Pharo 6 -- what do I need to do? Just checking my presumption... is PPCMNode>>#gtTreeViewIn: you own application method? So where it sends #name, instead send #printString (or #asString). Alternatively, #name is being sent to some domain object that doesn't implement #name, so it falls back to the super one from Object. So implement YourDomainObject>>#name: so the one from Object is not executed. cheers -ben On Sat, Aug 26, 2017 at 4:38 PM, H. Hirzel <hannes.hirzel@gmail.com <mailto:hannes.hirzel@gmail.com> > wrote: OK, so #name should not be used at all [1] The error message I get is PPCommonMarkSpecTest class>>DoIt (blockVisitor is Undeclared) The method Object>>#name called from PPCMNode>>#gtTreeViewIn: has been deprecated. Implement your own domain representation of an object, or use #asString or #printString instead. I wonder how I can fix this without going to much into details. --Hannes ------------------------------------------------------------------------------------------------------------------------ [1] Pharo 6.1 source code: Object>>name "Answer a name for the receiver. This is used generically in the title of certain inspectors, such as the referred-to inspector, and specificially by various subsystems. By default, we let the object just print itself out.. " self deprecated: 'Implement your own domain representation of an object, or use #asString or #printString instead.' on: '27 May 2016' in: #Pharo6. ^ self printString On 8/25/17, Ben Coman <btc@openinworld.com <mailto:btc@openinworld.com> > wrote:
I don't have an Image to check, but I believe Object>>name just does "^self printString", so by default, in your application send #printString instead of #name.
cheers -ben
P.S. Perhaps this would be a good candidate for automated rewrite?
On Thu, Aug 24, 2017 at 8:49 PM, H. Hirzel <hannes.hirzel@gmail.com <mailto:hannes.hirzel@gmail.com> > wrote:
Hello
In the last days there was a discussion that
Object>>#name
should no longer be used. I did not follow the discussion in detail. What was decided how #name should be replaced?
What do I need to do if I get a deprecation warning [1]?
Thanks for the answer in advance
Hannes
[1] The method Object>>#name called from PPCMNode>>#gtTreeViewIn: has been deprecated. Implement your own domain representation of an object, or use #asString or #printString instead.
Select Proceed to continue, or close this window to cancel the operation.