Use of Smalltalk at: #ClassName (Re: [FIX] ImageReaderDepFix-nk)

Stephane Ducasse ducasse at iam.unibe.ch
Thu Jul 10 15:34:32 UTC 2003


Hi daniel and ned

I agree with you. I do not like the Smalltalk at: ifAbsent: use.
As we are convinced by that, I have no problem to remove them. One of 
the problem when refactoring
is that I do not want that people after say that I 
change"blkblkblablablabla".
So for these refactorings I just kept the semantics the same.

Stef

On Wednesday, July 9, 2003, at 05:19 PM, Daniel Vainsencher wrote:

> I agree very much. We should generally try hard to avoid having dynamic
> lookups of this sort, because they break "references to class", as well
> as other tools that analyze the code to find such references (such as
> MudPie).
>
> The correct ways to resolve such cases are indeed registries, class
> extensions and so forth.
>
> I know that the easy fix is to convert something into a dynamic lookup,
> but
> 1. In these cases it is usually an inappropriate use of reflective
> facilities.
> 2. While class extensions are slightly unfamiliar, they really are
> trivial to use and the appropriate solution in many cases.
>
> A good example for their use is #httpJpeg: - it should simply be moved
> to a category called #Graphics-Files, and bundled with Scamper. That's
> it.
>
> Someday, when we get a more general solution for all kinds of mime
> objects, we can convert to a registry.
>
> Daniel
>
> Ned Konz <ned at bike-nomad.com> wrote:
>> On Wednesday 09 July 2003 12:18 am, Stephane Ducasse wrote:
>>> Then your changes break when the class JPEGReader is not present.
>>> This is not a problem but this was not the intention
>>> of the original and stupid messages in Smalltalk
>>
>> Very true. With all the recent changes, I've been finding myself
>> writing a lot of code recently that looks like this:
>>
>> (Smalltalk at: #SomeClass ifPresent: [ :someClass | someClass
>> doSomething ]) ifNil: [ "oops, no class" ... ]
>>
>> which is one of those things that probably should be turned into a
>> separate method (dare I say in SystemDictionary).
>
>> -- 
>> Ned Konz
>> http://bike-nomad.com
>> GPG key ID: BEEA7EFE
>



More information about the Squeak-dev mailing list