<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<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>Good question which I cannot answer :-)</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>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><br>
</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">The idea is that you could use whitespace patterns ('Squeak *alpha') interchangeably with more powerful regular expressions ('Squeak \d+\.\d+alpha' asRegex) without needing to define separate messages wherever
 patterns are used. For example, we would need implement both #assert:matches: *and* #assert:matchesRegex: (TestCase), both #classesIn: *and* #classesInRegex: (provided that we wanted this feature) etc., each pair with exactly the same implementations that
 only deviate in terms of sending #match: vs. #matches:.</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">(For a practical example, you could take a look at
<a href="https://github.com/codeZeilen/SqueakByExample-english/tree/master/SmalltalkSources/SBE-Extract.package/SBEWorldHelper.class/instance" class="x_OWAAutoLink">
all these methods from SqueakByExample that contain 'match' in their name</a> and which all use #matches:. This project also includes a String >> #matches: extension so it is much easier to feed these morph query methods either with regexs or with simple patterns
 where regexs are unnecessary complicated.)</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><br>
</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">I agree that it might be confusing if you forget the #asRegex. However, I think this is a common problem in a language with duck typing and very-late binding. On the contrary, one could also argue that it might
 be confusing that in some situations you need to send #match:, but in other situations #matches: instead, as they basically do the same.</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><br>
</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">---</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><br>
</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">Hm, this discussion reminds me a bit of the recent debate about Symbol >> #numArgs/#value:value:. There we found that instead of handling symbols like blocks, we could also write an explicit converter (#asBlock).
 How would you think about a similar converter in this case? :-)</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">Something like: <span style="font-size:12pt">'Squeak *alpha'
</span><b style="font-size:12pt">patternAsRegex</b></div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><span style="font-size:12pt">'ab*' asRegex matches: 'a'. "true"</span><br>
</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">'ab*' asRegex matches: 'abb'. "true"</span><br>
</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">'ab*' patternAsRegex matches: 'a'. "false"</span><br>
</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">'ab*' </span><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">patternA</span><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">sRegex
 matches: 'abc'. "</span><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">true</span><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">"</span><br>
</span></div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"><br>
</span></span></div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">Pro: Actually a matcher - you don't have a string that
 partially behaves like a matcher and follows the same protocol, but an actual matcher. So you could also say 'ab*' patternAsRegex matchesIn:collect: ...</span></span></div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">Contra: Actually a matcher - this can be a significant
 drawback in terms of performance. For a simple '*xyz*' match, the regex equivalent was more than 100x slower than the whitespace version.</span></span></div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">A third variant would be an extra WhitespaceMatcher.
 But do we really need such a class?</span></span></div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"><br>
</span></span></div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">Best,</span></span></div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px"><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">Christoph</span></span></div>
</div>
<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 Jakob Reschke <forums.jakob@resfarm.de><br>
<b>Gesendet:</b> Freitag, 10. April 2020 11:36:37<br>
<b>An:</b> The general-purpose Squeak developers list<br>
<b>Betreff:</b> Re: [squeak-dev] The Inbox: Collections-ct.885.mcz</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">The patterns matched by match: are not regular expressions. Could this<br>
intermixing of vocabulary lead to confusion or even bugs (when someone<br>
is missing a test for their matching use case and forgot the asRegex)?<br>
<br>
Am Do., 9. Apr. 2020 um 14:39 Uhr schrieb Thiede, Christoph<br>
<Christoph.Thiede@student.hpi.uni-potsdam.de>:<br>
><br>
> See also SUnit-ct.127 (#assert:matches:) or Tests-ct.429 (#assertText:) in the Inbox which could benefit from this extension.<br>
><br>
><br>
> I would also welcome to completely rename #match: into #matches: for the reasons described below, how would you think about this?<br>
><br>
> Or should String >> #matches: rather be an extension method from the Regex-Core package?<br>
><br>
><br>
> Best,<br>
> Christoph<br>
> ________________________________<br>
> Von: Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von commits@source.squeak.org <commits@source.squeak.org><br>
> Gesendet: Donnerstag, 9. April 2020 14:35:36<br>
> An: squeak-dev@lists.squeakfoundation.org<br>
> Betreff: [squeak-dev] The Inbox: Collections-ct.885.mcz<br>
><br>
> Christoph Thiede uploaded a new version of Collections to project The Inbox:<br>
> <a href="http://source.squeak.org/inbox/Collections-ct.885.mcz">http://source.squeak.org/inbox/Collections-ct.885.mcz</a><br>
><br>
> ==================== Summary ====================<br>
><br>
> Name: Collections-ct.885<br>
> Author: ct<br>
> Time: 9 April 2020, 2:35:32.800949 pm<br>
> UUID: ddccd842-af02-a448-91f7-7556c8c7bf43<br>
> Ancestors: Collections-dtl.884<br>
><br>
> Proposal for discussion: Add String >> #matches: for polymorphy with RxMatcher.<br>
><br>
> This allows you to pass patterns strings whereever a RxMatcher is expected. Furthermore, IMHO the name #matches: gives you a better intuition for a test selector than #match: does.<br>
><br>
> | password patterns |<br>
> patterns := { '.{8,}' asRegex. '*password*'. '.*\d.*' asRegex }.<br>
> password := Project uiManager requestPassword: 'Enter a fake password'.<br>
> self assert: (patterns allSatisfy: [:pattern | pattern matches: password]) description: 'Your password is not safe enough'.<br>
><br>
> =============== Diff against Collections-dtl.884 ===============<br>
><br>
> Item was added:<br>
> + ----- Method: String>>matches: (in category 'comparing') -----<br>
> + matches: text<br>
> +        "For polymorphy with RxMatcher."<br>
> +<br>
> +        ^ self match: text!<br>
><br>
><br>
><br>
<br>
</div>
</span></font>
</body>
</html>