<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 10/25/2020 12:04 PM, Nicolás Papagna Maldonado via Cuis-dev
wrote:
<blockquote
cite="mid:CADGn7BOsZoj5Xa7O1AUZV18mOOLj3cL9V7YZbN_5GXupiuJQ4w@mail.gmail.com"
type="cite">
<div dir="ltr">Hi Folks,
<div><br>
</div>
<div>For some experiments I'm doing, I've created a subclass of
<font face="monospace">CodePackage</font> (let's call it <font
face="monospace">FakeCodePackage</font>) to make my tests
run fast that avoids accessing <font face="monospace">Smalltalk</font>
or <font face="monospace">SystemOrganization</font>.</div>
<div>When I filed-out the package and installed it in a fresh
image, to my surprise, the newly installed package was an
instance of <font face="monospace">FakeCodePackage</font>.</div>
<div><br>
</div>
<div>After poking around, I found this method in <font
face="monospace">CodePackage</font> that is used when saving
an instance:</div>
<br>
<font face="monospace">codePackageClass<br>
"Answer the specific CodePackage subclass to use."<br>
<br>
self class == CodePackage ifFalse: [<br>
^ self class ].<br>
self classesDo: [ :cls |<br>
(cls inheritsFrom: CodePackage)<br>
fTrue: [ ^ cls ]].<br>
^ nil</font>
<div><br>
</div>
<div>This means that whenever there is a subclass of <font
face="monospace">CodePackage</font> in the package being
saved, It is assumed that is the class that should be used to
re-creating the <font face="monospace">CodePackage</font>
instance when installing it.<br>
</div>
<div><br>
</div>
<div>In my case, <font face="monospace">FakeCodePackage </font>is
not fully functional as I use it only in my tests, so I was
unable to either delete the package or re-install it because
of all sorts of errors.<br>
Luckily this was a fresh image, so I had nothing to lose :)</div>
<div><br>
</div>
<div>I was wondering what is the use case for that, and if it
still relevant/in use.</div>
<div><br>
</div>
<div>Cheers!</div>
<div>Nico PM</div>
</div>
</blockquote>
<br>
Too bad you found this bug. I hadn't thought of people writing
subclasses of CodePackage, unless for instantiation of the package
itself. This is used by ColorExtrasPackage and MorphicMisc1Package.
It is only used to run #prePackageInstall and #postPackageInstall,
and I don't think it is a clean solution. Anyway, I just posted a
fix to that method, to also check for the package name.<br>
<br>
Thanks,<br>
<pre class="moz-signature" cols="72">--
Juan Vuletich
<a class="moz-txt-link-abbreviated" href="http://www.cuis-smalltalk.org">www.cuis-smalltalk.org</a>
<a class="moz-txt-link-freetext" href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a>
<a class="moz-txt-link-freetext" href="https://github.com/jvuletich">https://github.com/jvuletich</a>
<a class="moz-txt-link-freetext" href="https://www.linkedin.com/in/juan-vuletich-75611b3">https://www.linkedin.com/in/juan-vuletich-75611b3</a>
@JuanVuletich</pre>
</body>
</html>