[squeak-dev] The Inbox: System-ct.1073.mcz

Chris Muller asqueaker at gmail.com
Thu Aug 1 03:08:18 UTC 2019


>
>
> > On 30.07.2019, at 18:53, Christoph Thiede <
> christoph.thiede at student.hpi.uni-potsdam.de> wrote:
> >
> > Hi Tobias,
> >
> > isn't `Smalltalk at: #some ifPresent: [] ifAbsent: []` more convenient
> (and
> > strengthens encapsulation)?
>
> Doesn't it rather strengthen a God class?
>

There's nothing inherently wrong with "strengthening" an existing core
responsibility in a way that makes it easier to use from the outside.

Being wary of God classes is just a tool for assisting with what really
matters -- identifying the proper delegation of responsibility.


>
> > I thought this would also be the reason for
> > SmalltalkImage>>#at:ifPresent: & Co. ...
>
> There had been different approaches to fan out responsibilities from the
> Smalltalk global to
> other objects, and different views to consolidate.
>
> Anyhow, given that there are environments now and Smalltalk globals is
> actually not a SystemDictionary anymore but an Environment,
> at lease the access to global names, variables and classes should rather
> go through globals :)
>

I suspect one reason no one uses Environments (plesae correct me if I'm
wrong about that) is because it fundamentally only solves half the problem
it sets out to solve.  There's still an unavoidable possibility that
co-existence of a disparate packages will result in one of them to needing
to be modified (i.e., a simple collision on an extension method would do
the trick), which puts you right back at square 1, except with your system
now complicated by a partitioned namespace.

So, for most, "there are environments" is not really a true statement --
there is still just original, classic Smalltalk-80; one global namespace.
Simple, beautiful.  But that experimental Environments code is still in
there, if one is inclined to play with it.

In the meantime, SmalltalkImage already has #at:ifAbsent:,
#at:ifAbsentPut:, #at:ifPresent:, and at:ifPresentAndInMemory:.  Given that
no case was made against their presence, I should be fine to include this
one too, which'll help Smalltalk be more to be consistent with Dictionary
API.

+1 for trunk.

 - Chris


>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190731/5418bce4/attachment.html>


More information about the Squeak-dev mailing list