[squeak-dev] #identityCaseOf:
Tobias Pape
Das.Linux at gmx.de
Sun Mar 28 11:39:53 UTC 2021
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.
Otherwise, use an IdentityDictionary?
Best regards
-Tobias
More information about the Squeak-dev
mailing list
|