[squeak-dev] The Inbox: Tools-ct.945.mcz

Eliot Miranda eliot.miranda at gmail.com
Tue Feb 25 22:40:44 UTC 2020



> On Feb 25, 2020, at 9:57 AM, Thiede, Christoph <Christoph.Thiede at student.hpi.uni-potsdam.de> wrote:
> 
> 
> > All of ifTrue: ifFalse: and ifNotNil: evaluate to false
> 
> 
> 
> You mean nil. Alright! :-)
> 
oops :-(

> 
> Best,
> 
> Christoph
> 
> Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Eliot Miranda <eliot.miranda at gmail.com>
> Gesendet: Dienstag, 25. Februar 2020 18:49:52
> An: The general-purpose Squeak developers list
> Betreff: Re: [squeak-dev] The Inbox: Tools-ct.945.mcz
>  
> Hi Christoph, Hi All,
> 
>>> On Feb 25, 2020, at 9:33 AM, Thiede, Christoph <Christoph.Thiede at student.hpi.uni-potsdam.de> wrote:
>>> 
>> 
>> Is it nice to have an implicit ifNil: [nil] return value?
>> 
> 
> IMO *NO*!!
> 
> All of ifTrue: ifFalse: and ifNotNil: evaluate to false if their receiver is that which doesn’t select the block.  Not knowing this is illiteracy.  The definitions are there to be read (and there’s only six of them ferchrissakes).  Please let’s not go the gcc way and through passive aggressive warnings force every thing to be parenthesized and to not use ifTrue: ifFalse: and ifNotNil:, and to have to say [nil] instead of [].  Conciseness is a value in itself and the basics of Smalltalk literacy are very little effort to attain.
> 
> I remember with some horror in 1995 finding lots of code in the VisualWorks vm that looked like
> 
>     if (EXPR == true) ...
> 
> Please, no.
> 
>> 
>> Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
>> Gesendet: Dienstag, 25. Februar 2020 15:13:42
>> An: John Pfersich via Squeak-dev
>> Betreff: Re: [squeak-dev] The Inbox: Tools-ct.945.mcz
>>  
>> > I still feel like using #ifNil:, #ifNotNil: in a cascade is not right.
>> 
>> Me too. It's hard to read.
>> 
>> Best,
>> Marcel
>>> Am 25.02.2020 11:36:00 schrieb Levente Uzonyi <leves at caesar.elte.hu>:
>>> 
>>> Hi Christoph,
>>> 
>>> I still feel like using #ifNil:, #ifNotNil: in a cascade is not right.
>>> In this case, having #yourself inside the #ifNotNil: block looks more 
>>> natural to me:
>>> 
>>> ^(self browseVersionsOf: aCompiledMethod) ifNotNil: [:browser |
>>> browser
>>> selectMethod: aCompiledMethod;
>>> yourself ]
>>> 
>>> 
>>> Levente
>>> 
>>> On Mon, 24 Feb 2020, commits at source.squeak.org wrote:
>>> 
>>> > Christoph Thiede uploaded a new version of Tools to project The Inbox:
>>> > http://source.squeak.org/inbox/Tools-ct.945.mcz
>>> >
>>> > ==================== Summary ====================
>>> >
>>> > Name: Tools-ct.945
>>> > Author: ct
>>> > Time: 24 February 2020, 1:56:51.392323 pm
>>> > UUID: cc577466-ca48-484b-9454-11ae7ffde0b2
>>> > Ancestors: Tools-mt.940
>>> >
>>> > Fixes a bug/unnecessary limitation in VersionsBrowser class >> #browseMethod: that raised an error when browsing a method that had been removed from the system.
>>> >
>>> > You can also reproduce it via: thisContext method browse "on a fresh image".
>>> >
>>> > This commit replaces Tools-ct.944, which has been refactored again to reuse the return carat according to Kent Beck ("Format conditionals so their value is used where it clearly expresses the intent of the method"). Thanks to Chris for the reminder!
>>> >
>>> > =============== Diff against Tools-mt.940 ===============
>>> >
>>> > Item was changed:
>>> > ----- Method: VersionsBrowser class>>browseMethod: (in category 'instance creation') -----
>>> > browseMethod: aCompiledMethod
>>> > 
>>> > + ^ (self browseVersionsOf: aCompiledMethod)
>>> > + ifNotNil: [:browser |
>>> > + browser selectMethod: aCompiledMethod];
>>> > - ^ (self browseVersionsForClass: aCompiledMethod methodClass selector: aCompiledMethod selector)
>>> > - selectMethod: aCompiledMethod;
>>> > yourself!
>>> >
>>> > Item was added:
>>> > + ----- Method: VersionsBrowser class>>browseVersionsOf: (in category 'instance creation') -----
>>> > + browseVersionsOf: aCompiledMethod
>>> > + 
>>> > + | methodClass methodSelector |
>>> > + methodClass := aCompiledMethod methodClass.
>>> > + methodSelector := aCompiledMethod selector.
>>> > + ^ self
>>> > + browseVersionsOf: aCompiledMethod
>>> > + class: methodClass
>>> > + meta: methodClass isMeta
>>> > + category: (methodClass organization categoryOfElement: methodSelector)
>>> > + selector: methodSelector!
>>> 
>> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200225/6a2d712b/attachment.html>


More information about the Squeak-dev mailing list