<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p>Hi all,</p>
<p><br>
</p>
<p></p>
<div>> > @Levente: Glad you like it! Regarding arguments, did you read [2]? It's already a bit older but I have not continued working on this since I'm afraid have not got any feedback on the proposal. :-)</div>
<div>> </div>
<div>> I had a look at the change set. It looks good but seems to lack <span style="font-size:12pt">decompiler-related changes which I think are necessary to keep the </span><span style="font-size:12pt">decompiler working.</span></div>
<div><br>
</div>
<div>Thank you! I'll put this onto my to-do list again (but will have a short vacation first). :-)</div>
<br>
<p></p>
<p><br>
</p>
<p>> <span style="font-size:12pt">If you need more than a few of these, you're circumventing the actual method dispatch </span><span style="font-size:12pt">by dispatching on identity manually.</span></p>
<div><br>
</div>
<div>Dispatching on identity is not possible always, I guess? Consider the example in PreferenceBrowserMorph I mentioned earlier (I think we have many of them in Morphic). I don't think something like an extension method Character >> #doKeyboardActionForPreferenceBrowserMorph:
 would be an appropriate refactoring here. ;-)</div>
<div>Still, I see your point that #caseOf:[otherwise:] *can* be a code smell and point to a necessary refactoring in the form of dispatching. If I would read something like "anObject class caseOf: {...", I would definitively dislike that, too, of course.</div>
<div>Nevertheless, I think that dispatching solutions do not scale well for small snippets in all situations. Unless I find multiple instances of such a coding smell, I would hesitate to apply a fancy pattern (Simple Design, DTSTTCPW, YAGNI, Rule of Three,
 etc.). In such situations, I think #caseOf:[otherwise:] is just a helper to write less duplicated code.</div>
<div>And LBNL, Levente's new proposal shows additional use cases for #caseOf: that go beyond simple identity dispatching. :-)</div>
<div><br>
</div>
<div>btw:</div>
<div><br>
</div>
<div>> <span style="font-size:12pt">If you're building a bytecode interpreter, fine, but in that case, metaprogramming or code generation is not too far fetched either.</span>
<div><br>
</div>
<div>Is code generation really advisable whenever you have an alternative? I don't have experience with it, but when I hear "generation" I always have to think of "synchronization issues", too ... You are building derived structures that either need to be kept
 in sync with the originating structure, or that have to be considered as read-only which makes tooling even harder. Or is this only my impression?</div>
<div><br>
</div>
<div>Best,</div>
<div>Christoph</div>
</div>
<p></p>
<div id="x_Signature">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="x_divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von Tobias Pape <Das.Linux@gmx.de><br>
<b>Gesendet:</b> Sonntag, 28. März 2021 16:48:22<br>
<b>An:</b> The general-purpose Squeak developers list<br>
<b>Betreff:</b> Re: [squeak-dev] #identityCaseOf:</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText"><br>
<br>
> On 28. Mar 2021, at 16:03, Levente Uzonyi <leves@caesar.elte.hu> wrote:<br>
> <br>
> On Sun, 28 Mar 2021, Tobias Pape wrote:<br>
> <br>
>> Hi<br>
>> <br>
>> <br>
>>> On 28. Mar 2021, at 07:12, tim Rowledge <tim@rowledge.org> wrote:<br>
>>>> On 2021-03-27, at 11:47 AM, Thiede, Christoph <Christoph.Thiede@student.hpi.uni-potsdam.de> wrote:<br>
>>>> Hi all,<br>
>>>> the proposal is in the title. :-) Do you think we could need something like #identityCaseOf:[otherwise:], analogously to #caseOf:[otherwise:], on Object?<br>
>>> 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."<br>
>> <br>
>> Exactly.<br>
>> If you need something like that, there's either a missing polymorphic abstraction, or a few ifTrue:'s are sufficient.<br>
>> (as in the case of #update:<br>
>> <br>
>> update: aSymbol<br>
>> <br>
>> aSymbol == #foo ifTrue: [^ self knorz].<br>
>> aSymbol == #bar ifTrue: [^ self berfp].<br>
>> ^ false<br>
>> <br>
>> I think this is sufficient.<br>
> <br>
> 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.<br>
<br>
<br>
If you need more than a few of these, you're circumventing the actual method dispatch<br>
by dispatching on identity manually.<br>
Why making such nonsense easier?<br>
<br>
If you're building a bytecode interpreter, fine, but in that case, metaprogramming or code generation is not too far fetched either.<br>
<br>
-t<br>
<br>
> <br>
>> <br>
>> Otherwise, use an IdentityDictionary?<br>
> <br>
> Ah, the good old Pharo-way of doing things. :D<br>
> <br>
> All-in-all, it looks as though we're slipping into another caseOf: vs no-caseOf: discussion. Let's not do that.<br>
> <br>
> <br>
> Levente<br>
> <br>
>> <br>
>> Best regards<br>
>>       -Tobias<br>
> <br>
<br>
<br>
<br>
</div>
</span></font>
</body>
</html>