<div dir="ltr">Very interesting - thank you!</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 16 Jul 2022 at 20:24, Mariano Montone via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st">cuis-dev@lists.cuis.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div>Hi,</div>
<div><br>
</div>
<div>for those interested, there are some
possible Smalltalk syntax extensions considered in this talk:
<a href="https://www.youtube.com/watch?v=ZM2opfrGBXY" target="_blank">https://www.youtube.com/watch?v=ZM2opfrGBXY</a></div>
<div><br>
</div>
<div> Mariano</div>
<div><br>
</div>
<div>El 15/7/22 a las 15:38, Francisco Garau
via Cuis-dev escribió:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>Hola Amigos -- just wanted to share with you some ideas
I've been thinking about for a while. </div>
<div><br>
</div>
<div>It all started when someone mentioned the colon in the
syntax for block arguments could have whitespace around the
argument so that you could write <font face="monospace">[ :
n | n + 1] </font></div>
<div><br>
</div>
<div>It makes perfect sense to see the block as an "inlined"
method that doesn't require any method-lookup; therefore, the
selector is superfluous. But if we accepted the selector
inside the block, it could be used as the variable holding the
block. So, instead of writing <font face="monospace">succ :=
[:n | n + 1]</font> we could write <font face="monospace">[succ:
n | n + 1]</font> </div>
<div><br>
</div>
<div>Even better if the block evaluation accepts #: as a valid
selector. So you could write <font face="monospace">(succ:
3) = 4</font> instead of <font face="monospace">(succ value:
3) = 4</font>. </div>
<div><br>
</div>
<div>A short example will make this clear. </div>
<div><br>
</div>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div>Vanilla Smalltalk</div>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div>succ := [:n | n + 1].</div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div>(succ value: 3) = 4. </div>
</blockquote>
<div><br>
</div>
<div>Extended Block Syntax</div>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div>[succ: n | n + 1]. </div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div>(succ: 3 ) = 4. </div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div>"the above is equivalent to" </div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div>(succ perform: #: with: 3) = 4. </div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div><br>
</div>
</blockquote>
<div>Being able to parse blocks with these syntax paves the
way to unify the syntax for method definition—for example, a
few hypothetical methods from the Point class. <br>
</div>
<div>
<div><br>
</div>
</div>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div>
<div>"Point class>x:y:" </div>
</div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div>
<div>[x: xInteger y: yInteger | </div>
</div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div>
<div> ^self basicNew setX: xInteger setY: yInteger].</div>
</div>
</blockquote>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div><br>
</div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div>
<div>"Point>>abs"</div>
</div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div>
<div>[abs | </div>
</div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div>
<div> ^x abs @ y abs]. </div>
</div>
</blockquote>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div><br>
</div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div>
<div>"Point>>extent:" </div>
</div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div>
<div>[extent: aPoint |</div>
</div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div>
<div> ^Rectangle origin: self extent: aPoint] </div>
</div>
</blockquote>
</blockquote>
<div>
<div><br>
</div>
</div>
<div>Of course, it gets trickier when blocks have more than one
argument.. <br>
</div>
<div><br>
</div>
<div>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div>[add: a to: b | a + b]. </div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div>(add_to value: 3 value: 4) = 7. "old style block
evaluation" </div>
</blockquote>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div>(add: 3 to: 4) = 7. </div>
<div><br>
</div>
</blockquote>
</div>
<div>I think building a separate Parser is a sensible approach
-- is there a Smalltalk Parser as a separate package that can
be tweaked without affecting the running image?<br>
</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Francisco</div>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<fieldset></fieldset>
</blockquote>
<p><br>
</p>
</div>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote></div>