[squeak-dev] #identityCaseOf:
Tobias Pape
Das.Linux at gmx.de
Sun Mar 28 14:45:30 UTC 2021
> On 28. Mar 2021, at 16:03, Levente Uzonyi <leves at caesar.elte.hu> wrote:
>
> On Sun, 28 Mar 2021, Tobias Pape wrote:
>
>> Hi
>>
>>
>>> On 28. Mar 2021, at 07:12, tim Rowledge <tim at rowledge.org> wrote:
>>>> On 2021-03-27, at 11:47 AM, Thiede, Christoph <Christoph.Thiede at student.hpi.uni-potsdam.de> wrote:
>>>> Hi all,
>>>> the proposal is in the title. :-) Do you think we could need something like #identityCaseOf:[otherwise:], analogously to #caseOf:[otherwise:], on Object?
>>> I would go with 'not'. I'm not a fan of #caseOf: either. Far too like C. Slippery slope to "oooh, let's have thing.ivar.ivar to be like structs."
>>
>> Exactly.
>> If you need something like that, there's either a missing polymorphic abstraction, or a few ifTrue:'s are sufficient.
>> (as in the case of #update:
>>
>> update: aSymbol
>>
>> aSymbol == #foo ifTrue: [^ self knorz].
>> aSymbol == #bar ifTrue: [^ self berfp].
>> ^ false
>>
>> I think this is sufficient.
>
> Those ifTrue:'s quickly render your code unreadable or force you to extract chunks of your code into a separate method which can impair legibility.
>
>>
>> Otherwise, use an IdentityDictionary?
>
> Ah, the good old Pharo-way of doing things. :D
what?
-t
>
> All-in-all, it looks as though we're slipping into another caseOf: vs no-caseOf: discussion. Let's not do that.
>
>
> Levente
>
>>
>> Best regards
>> -Tobias
More information about the Squeak-dev
mailing list
|