<div dir="auto">Got it. For base image changesets, think long and hard before introducing a new type of object, no matter how trivial.<div dir="auto"><br></div><div dir="auto">Thanks.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jul 28, 2023, 6:33 AM Juan Vuletich <<a href="mailto:juan@cuis.st">juan@cuis.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div bgcolor="#ffffff" text="#000000">
Hi Imran,<br>
<br>
On 7/27/2023 7:50 PM, Imran Rafique via Cuis-dev wrote:
<blockquote type="cite">
<div dir="auto">
<div>Juan,
<div dir="auto"><br>
</div>
<div dir="auto">Thanks for taking the time to point me in the
right direction. Much appreciated. Yes, lots I
hadn't thought of.</div>
<div dir="auto"><br>
</div>
<div dir="auto">Just one question: in Cuis, do you prefer to
not have specific Error subclasses and just call 'self
error:' ?</div>
</div>
</div>
</blockquote>
<br>
It is a more general idea. Anything that goes in the image has an
upside and a downside. A benefit and a cost. The upside includes the
functionality, the insights it may teach readers, expandability,
etc. The downside is _not_ the time it takes to write code. That is
only paid once. It is not the memory required. In most cases there
is so much memory that even a couple of kb mean nothing. The real
cost is the cognitive burden on readers. Another thing to understand
and remember about. In Cuis we work hard to keep complexity low.
That means, for example, avoiding new classes that don't carry their
own weight. Classes are globals. They take room in the global
namespace, and they show up often, no matter what you are trying to
focus on. In general, classes in the base image are irrelevant to
the problem you are working on. The less of them, the better. The
more relevant they are, the better.<br>
<br>
In this case, handling tilde is worth a few lines of code. But not a
new class unless it is really needed, and even then maybe the
decision would be not to handle tilde at all! It is not _that_
important, and any app can require OSProcess and handle it itself.
But a couple of lines of code is ok, so they are in.<br>
<br>
Other exceptions are used more often, and many programmers will
prefer to know about them and perhaps handle them. Those are
included in the base image.<br>
<br>
WRT to library or application code, it is up to you, or the
developers of the library or app. In that context they will judge
what is relevant, and what knowledge they want to embody in the
software.<br>
<br>
Hope this makes sense to you.<br>
<br>
Cheers,<br>
<br>
<blockquote type="cite">
<div dir="auto">
<div><br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, Jul 27, 2023, 1:27
PM Juan Vuletich <<a href="mailto:juan@cuis.st" rel="noreferrer noreferrer noreferrer" target="_blank">juan@cuis.st</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Imran,<br>
<br>
There are a few issues with your change set.<br>
- It breaks paths like '../../stuff' .The loop was there
for a reason.<br>
- Even with OSProcess it is possible that the $HOME
variable is not defined.<br>
- Holding a workaround folder in a class variable can be
problematic, <br>
especially if the image is saved. Or if OSProcess is
loaded after this. <br>
It can also hide this problem for other code that asks for
a folder.<br>
<br>
I pushed instead a different implementation that addresses
this issues, <br>
as update #5898.<br>
<br>
To handle the situation you can do something like<br>
<br>
[ '~/Toto' asDirectoryEntry ] on: Error do: [ :error |
error description <br>
print. error retryUsing: '/elToto' asDirectoryEntry ]<br>
<br>
Having the description of the error in available in a
method lets you <br>
validate the kind of error, to be sure.<br>
<br>
Finally, to test base image functionality, a change set to
be loaded in <br>
BaseImageTests is OK. If you also want to test the
behavior with <br>
OSProcess loaded, another test for the OSProcess package
is an <br>
alternative. In that test, don't forget to test that the
HOME variable <br>
can be resolved, and do nothing if not. Otherwise the test
will fail in <br>
some environments (I can think of Windows, but I'm sure
there are others <br>
where HOME is not an environment variable).<br>
<br>
Thanks,<br>
<br>
On 7/27/2023 11:07 AM, Imran Rafique via Cuis-dev wrote:<br>
> Juan& Hernan,<br>
><br>
> I **think** the attached changeset does what you
wanted. I may have<br>
> overcomplicated things somewhat, but in any case, its
a great learning<br>
> experience.<br>
><br>
><br>
> Gives an exception if OSProcess is not available:<br>
><br>
> '~/foo' asFileEntry.<br>
><br>
><br>
> Sets a default homedir in case we cannot read
environment variables:<br>
><br>
> [ '~/foo' asDirectoryEntry ] on: NeedsPackage
do: [ :ex |<br>
> FileIOAccessor homeDirDefault: '/home/guess'. ex
retry ]<br>
><br>
><br>
> BTW, whats the preferred way of including tests for
changesets like this?<br>
><br>
> --<br>
> Regards,<br>
> Imran Sher Rafique<br>
<br>
-- <br>
Juan Vuletich<br>
<a href="http://cuis.st" rel="noreferrer noreferrer noreferrer noreferrer noreferrer" target="_blank">cuis.st</a><br>
<a href="http://github.com/jvuletich" rel="noreferrer
noreferrer noreferrer noreferrer noreferrer" target="_blank">github.com/jvuletich</a><br>
<a href="http://researchgate.net/profile/Juan-Vuletich" rel="noreferrer noreferrer noreferrer noreferrer noreferrer" target="_blank">researchgate.net/profile/Juan-Vuletich</a><br>
<a href="http://independent.academia.edu/JuanVuletich" rel="noreferrer noreferrer noreferrer noreferrer noreferrer" target="_blank">independent.academia.edu/JuanVuletich</a><br>
<a href="http://patents.justia.com/inventor/juan-manuel-vuletich" rel="noreferrer noreferrer noreferrer noreferrer noreferrer" target="_blank">patents.justia.com/inventor/juan-manuel-vuletich</a><br>
<a href="http://linkedin.com/in/juan-vuletich-75611b3" rel="noreferrer noreferrer noreferrer noreferrer noreferrer" target="_blank">linkedin.com/in/juan-vuletich-75611b3</a><br>
<a href="http://twitter.com/JuanVuletich" rel="noreferrer
noreferrer noreferrer noreferrer noreferrer" target="_blank">twitter.com/JuanVuletich</a><br>
<br>
</blockquote>
</div>
</div>
</div>
</blockquote>
<br>
<br>
<pre cols="72">--
Juan Vuletich
<a href="http://cuis.st" target="_blank" rel="noreferrer">cuis.st</a>
<a href="http://github.com/jvuletich" target="_blank" rel="noreferrer">github.com/jvuletich</a>
<a href="http://researchgate.net/profile/Juan-Vuletich" target="_blank" rel="noreferrer">researchgate.net/profile/Juan-Vuletich</a>
<a href="http://independent.academia.edu/JuanVuletich" target="_blank" rel="noreferrer">independent.academia.edu/JuanVuletich</a>
<a href="http://patents.justia.com/inventor/juan-manuel-vuletich" target="_blank" rel="noreferrer">patents.justia.com/inventor/juan-manuel-vuletich</a>
<a href="http://linkedin.com/in/juan-vuletich-75611b3" target="_blank" rel="noreferrer">linkedin.com/in/juan-vuletich-75611b3</a>
<a href="http://twitter.com/JuanVuletich" target="_blank" rel="noreferrer">twitter.com/JuanVuletich</a></pre>
</div>
</blockquote></div>