<div dir="ltr"><div dir="ltr">Nicola,</div><div><br></div>tl;dr version: If you haven't already seen it, I'd suggest watching <a href="https://www.youtube.com/watch?v=jXuoFEkg6UA">https://www.youtube.com/watch?v=jXuoFEkg6UA</a> as it discusses an approach to dealing with method overrides, adding instvars etc.<div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Aug 14, 2021 at 1:46 PM Nicola Mingotti via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st">cuis-dev@lists.cuis.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<font size="+1"><font face="monospace">Hi guys,<br>
<br>
I have this question for you. I will describe the problem with
an example.<br>
<br>
I defined a method in my package 'Wunderbar', it is
'readFromString', which<br>
goes into class 'Json class side' and method category
'*Wunderbar-DB'.<br>
<br>
Now, suppose a day in the future I upgrade Cuis and
'readFromString'<br>
is now defined into 'Json class'.</font></font></div></blockquote><div><br></div><div>While you didn't specifically ask about it, this is a good example of why you don't want to apply updates to a modified image... behavior is often undefined. If you applied updates on top of your loaded code, the updates would replace your method which usually isn't what you want but you would not get any warning indicating it happened. So if you saved your package after applying updates to a modified image, your version of the method would disappear and you likely wouldn't discover it until you next try to rebuild your image. Or worse, until some point in the future after that.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><font size="+1"><font face="monospace"> What will happen when i try to
load 'Wunderbar' package ?<br></font></font></div></blockquote><div><br></div><div>When you load your package, your method will replace the system defined one. This is also a good way to have issues if you're not expecting it: there will often be code elsewhere in the system depending on this new default behavior which your method may not provide since you wrote your method before the new one in the core image existed. This gets back to the video I recommended at the top of this response... you not only need to make sure that your code is the last code applied, but also that any overrides you are doing are to the version of the method you are expecting. (i.e. you want ensure both your code works as well as any other code in the image that depended on the old method)</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><font size="+1"><font face="monospace">
<br>
. Do i get an error for method name overlap ?<br></font></font></div></blockquote><div><br></div><div>No, there is no overlap.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><font size="+1"><font face="monospace">
. If not, is there any criteria by which one method should be
called instead of the other<br>
for example: looking at which method category it belongs to ?<br></font></font></div></blockquote><div><br></div><div>The method category (i.e. *<package>) effectively just tells the system which package 'owns' the method. However, a given method for a given class can only exist in one place. Whoever defined it last wins.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><font size="+1"><font face="monospace">
<br>
<br>
bye<br>
<br>
Nicola<br>
</font></font></div></blockquote><div><br></div><div>Thanks,</div><div>Phil </div></div></div></div>