<body><div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">
                                        What about unwanted side effects that are in-image? My precious collection of objects here, my background wallpaper there ... I don't want my wallpaper to turn black and my objects to get lost ... or surprisingly sorted for that matter. :-)<div><br></div><div>Best,</div><div>Marcel</div><div class="mb_sig"></div><blockquote class="history_container" type="cite" style="border-left-style:solid;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 17.10.2019 20:47:57 schrieb Eliot Miranda <eliot.miranda@gmail.com>:</p><div style="font-family:Arial,Helvetica,sans-serif">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 17, 2019 at 11:13 AM Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 16, 2019 at 2:55 AM Thiede, Christoph <<a href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de" target="_blank">Christoph.Thiede@student.hpi.uni-potsdam.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">




<div dir="ltr">
<div id="gmail-m_3654133678284754768gmail-m_-709602035930772666divtagdefaultwrapper" style="font-size: 12pt;color: rgb(0,0,0);font-family: Calibri,Helvetica,sans-serif" dir="ltr">
<div id="gmail-m_3654133678284754768gmail-m_-709602035930772666divtagdefaultwrapper" 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" dir="ltr">
<p>Hi Marcel,</p>
<p>as I see it, this Blocks check only restricts the possible hits, so removing it should not damage any existing functionality. (I am *not* talking about modifying <span>Dangerous!)</span></p>
<p>And if you do</p>
</div>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div 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" dir="ltr">
<p><span>MethodFinder methodFor: {{#(1 2). [:x | Smalltalk saveSession. false]}.#()} "pls don't run this!"</span></p>
</div>
</blockquote>
<div 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" dir="ltr">
<p><span>you will surely expect the side effects to be executed?</span></p></div></div></div></blockquote><div><br></div><div>If MethodFinder were implemented using simulation (a la Context class>>runSimulated:) then we could implement a proper sandbox and completely discard Dangerous.  We could catch any attempt to change the class hierarchy, save a snapshot, etc.</div></div></div></blockquote><div><br></div><div>It would be a great project to create a subclass of Context, say SandboxContext, and have this ensure that when simulating it only creates more SandboxContexts, never a normal Context, and have SandboxContext override primitive invocation.  This could be a place to intercept modification of the class hierarchy (at:put: & become: on MethodDictionary, and Array to see if an attempt is being made to assign to or become: a MethodDictionary and/or a subclasses Array).  Perhaps SandboxContext would need SandboxClosure, perhaps it could simply intercept value: et al on Closure (see Context>>#doPrimitive:method:receiver:args:).</div><div><br></div><div>My gut tells me that while this implementation is clever, it will also be more general and more easily maintainable than the current one.  There are issues; a time limit would have to be placed upon simulated executions (that's also a potential issue for the current implementation).  But it would be safer since instead of relying on Dangerous to identify dangerous code it would depend on a reasonably well-defined notion of sandbox, what is possible to evaluate when searching, and what is not.  One could, for example, implement an instantiation budget in SandboxContext>>#doPrimitive:method:receiver:args:.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div id="gmail-m_3654133678284754768gmail-m_-709602035930772666divtagdefaultwrapper" style="font-size: 12pt;color: rgb(0,0,0);font-family: Calibri,Helvetica,sans-serif" dir="ltr"><div 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" dir="ltr">
<p><span style="font-size: 12pt">> </span><span style="font-size: 12pt">Just curious: what would be the block example for these examples?</span></p>
<p></p>
<p><span></span></p>
<div>MethodFinder methodFor: {{#(1 2). #even}. #(1)}. <b>'(data1 reject: data2) '</b></div>
<div>MethodFinder methodFor: {{#(1 2). #yourself descending}. #(2 1)}. <b>'(data1 sorted: data2) (data1 sort: data2) '</b></div>
<div><br>
</div>
Hey, maybe we should make a small game of it? :-) GuessTheSelectorGame :D
<p></p>
<p><span>Christoph</span></p>
<div id="gmail-m_3654133678284754768gmail-m_-709602035930772666Signature">
<div name="divtagdefaultwrapper">
<div><span style="font-size: 10pt;color: #808080"></span></div>
</div>
</div>
<br>
<br>
<div style="color:rgb(0,0,0)">
<hr style="display:inline-block;width:98%">
<div id="gmail-m_3654133678284754768gmail-m_-709602035930772666divRplyFwdMsg" dir="ltr"><span style="font-family: Calibri, sans-serif;color: #000000"><b>Von:</b> Squeak-dev <<a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" target="_blank">squeak-dev-bounces@lists.squeakfoundation.org</a>> im Auftrag von Taeumel, Marcel<br>
<b>Gesendet:</b> Mittwoch, 16. Oktober 2019 10:54 Uhr<br>
<b>An:</b> gettimothy via Squeak-dev; <a href="mailto:squeak-dev@mail.squeak.org" target="_blank">squeak-dev@mail.squeak.org</a><br>
<b>Betreff:</b> Re: [squeak-dev] MethodFinder.Blocks</span>
<div> </div>
</div>
<div>
<div id="gmail-m_3654133678284754768gmail-m_-709602035930772666__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0)">
Hi, Christoph.
<div><br>
</div>
<div>The method finder (or selector browser) has a hard-coded list of possible results (or messages) to not trigger dangerous side effects. Any new feature, such as that "quasi higher-order-message" symbol , would have to be added. Sure. But keep compatiblility
 with block arguments. :-)</div>
<div><br>
</div>
<div>Just curious: what would be the block example for these examples?</div>
<div><br>
</div>
<div><span style="font-family: Calibri,Helvetica,sans-serif;font-size: 16px">MethodFinder methodFor: {{#(1 2). #even}. #(1)}</span></div>
<div><span style="font-family: Calibri,Helvetica,sans-serif;font-size: 16px">MethodFinder methodFor: {{#(1 2). #yourself descending}. #(2 1)}.</span></div>
<div><span style="font-family: Calibri,Helvetica,sans-serif;font-size: 16px"><br>
</span></div>
<div><span style="font-family: Calibri,Helvetica,sans-serif;font-size: 16px">Especially the latter seems kind of cryptic to me.</span></div>
<div><span style="font-family: Calibri,Helvetica,sans-serif;font-size: 16px"><br>
</span></div>
<div>Best,</div>
<div>Marcel</div>
<div><br>
</div>
<div></div>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-top:20px;margin-left:0px;padding-left:10px">
<p style="color:rgb(170,170,170);margin-top:10px">Am 14.10.2019 01:27:12 schrieb Thiede, Christoph <<a href="mailto:christoph.thiede@student.hpi.uni-potsdam.de" target="_blank">christoph.thiede@student.hpi.uni-potsdam.de</a>>:</p>
<div style="font-family:Arial,Helvetica,sans-serif">
<div id="gmail-m_3654133678284754768gmail-m_-709602035930772666divtagdefaultwrapper" 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">
<p>Hi all,</p>
<p><br>
</p>
<p>I just got irritated as I evaluated</p>
<p><br>
</p>
<p><span>MethodFinder methodFor: {{#(1 2). #even}. #(1)}</span></p>
<p><br>
</p>
<p>and got no hit.</p>
<p>This is because the MethodFinder stores an extra list of selector parameters that are assumed to require a block argument (Blocks) -- but nowadays this requirement is not given, as you can pass a Symbol, MessageSend, SortFunction or whatsoever, thanks to
 polymorphy. So (how) is this block check still relevant? If I remove it, I get the right hit and can do thinks like</p>
<p><br>
</p>
<p><span>MethodFinder methodFor: {{#(1 2). #yourself descending}. #(2 1)}.</span><br>
</p>
<p><span><br>
</span></p>
<p><span>Also, #ifError: will prevent any error thrown if the block does not match the selector.</span></p>
<p><br>
</p>
<p>Looking forward to your answers :)</p>
<p>Christoph</p>
<div id="gmail-m_3654133678284754768gmail-m_-709602035930772666Signature">
<div name="divtagdefaultwrapper">
<div><span style="font-size: 10pt;color: rgb(128,128,128)"></span></div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>

<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><span style="font-size: 10pt;border-collapse: separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-size: 10pt;border-collapse: separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div></div></div>
</div></blockquote>
                                        </div></body>