Eliot,<br><br>Really? No semicolons?... Why?... I thought that from<br><br>Bezier2Segment>>ellipseSegments<br><br> ^{all those 8 things}<br><br><br>one would have somewhere<br><br><blablabla><br> someBezier2Segment ellipseSegments do: aBlock<br>
<blablabla><br><br><br>but then that would reduce to<br><br>Bezier2Segment>>ellipseSegmentsDo: aBlock<br><br> aBlock<br> value: seg1a;<br> (etc)<br> value: seg8a;<br> value: seg8b<br><br><br>What did I miss here?<br>
<br>Andres.<br><br><br><div class="gmail_quote">On Mon, Mar 24, 2008 at 6:45 PM, Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><br><div class="gmail_quote"><div class="Ih2E3d">On Mon, Mar 24, 2008 at 6:18 PM, Andres Valloud <<a href="mailto:andres.valloud@gmail.com" target="_blank">andres.valloud@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Eliot,<br><br>Re: the Bezier2Segment... if I remember correctly, the {} syntax creates a literal at compile time. Is that so? Or is the array created every time execution goes over {}?<br><br>In the case of Bezier2Segment, what I think is at times missing from consideration is what is usually done with such arrays... do: aBlock? Because if so, it would be cheaper (and *sometimes* clearer) to do:<br>
<br>Bezier2Segment>>ellipseSegmentsDo: aBlock<br><br> aBlock<br> value: seg1a;<br> value: seg1b;<br>
value: seg2a;<br>
value: seg2b;<br>
value: seg3a;<br>
value: seg3b;<br>
value: seg4a;<br>
value: seg4b</blockquote></div><div><br>Um, semicolons aren't what you mean. You want a Closure>>value:value:value:value:value:value:value:value: method (right?), and there isn't one. You have to use valueWithArguments:. But there isn't even an ArrayedCollection class>>with:with:with:with:with:with:with:with: method to construct one with(*). So once again a brace construct is the most convenient way to implement Closure>>value:value:value:value:value:value:value:value:.<br>
<br>(*) at least you can write ArrayedCollection class>>with:with:with:with:with:with:with:with:. You can't write Closure>>value:value:value:value:value:value:value:value:value: directly because it would be a primitive and either an 8-arg primitive may not be available or a varargs primitive may not accept more than 3 arguments. If you write it in terms of valueWithArguments: you still need Array class>>with:with:with:with:with:with:with:with: to construct the argument vector (or of course the convenient brace construct).<br>
<br> </div><div class="Ih2E3d"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">One could further wonder why are there so many of these seg* things floating around...</blockquote>
</div><div><br>Because sometimes things come in octets... <br></div><div><div></div><div class="Wj3C7c"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><br>Just my opinion though,<br>
<font color="#888888">Andres.</font><div><div></div><div><br><br><br><div class="gmail_quote">On Mon, Mar 24, 2008 at 6:09 PM, Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br><br><div class="gmail_quote"><div>On Sat, Mar 22, 2008 at 1:44 PM, Andres Valloud <<a href="mailto:andres.valloud@gmail.com" target="_blank">andres.valloud@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I think something that is being left unaddressed is whether using
literal arrays that allow code expressions (e.g.: the brace syntax in
Squeak) is a good practice or not. In my experience, I have not felt
the need for such things, but maybe I have not been exposed to
particular circumstances in which they become useful. Does anybody
have some slam dunk examples that can be shared so that we can evaluate
this better?</blockquote></div><div><br>Just open any recent Squeak image and broseer senders of #braceArray, e.g. the last line of<br>Bezier2Segment>>makeEllipseSegments: aRectangle in Squeak V3.9 reads<br><br> ^{seg1a. seg1b. seg2a. seg2b. seg3a. seg3b. seg4a. seg4b}<br>
<br>instead of<br> ^(Array with: seg1a with: seg1b with: seg2a with: seg2b),<br> (Array with: seg3a with: seg3b with: seg4a with: seg4b)<br><br>BTW, the first example tat comes up in my image contains:<br> {'zip'.'sar'.'pr'. 'mcz'. '*'} includes: suffix<br>
which is better written as<br> #('zip' 'sar' 'pr' 'mcz' '*') includes: suffix<br>so one can argue that it can be confusing for some to have two apparently similar constructs. But in my experience {} carries its weight (and there's no doubt that #() does).<br>
<br></div><div><div></div><div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br><font color="#888888">
<br>
Andres.<br><br></font><div class="gmail_quote"><div><div></div><div>On Tue, Mar 18, 2008 at 9:57 AM, Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>> wrote:<br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div><div>On Mon, Mar 17, 2008 at 2:11 PM, Craig Latta <<a href="mailto:craig@netjam.org" target="_blank">craig@netjam.org</a>> wrote:<br>
</div><div class="gmail_quote"><div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
> Defining new language elements is hard. The worst that could happen<br>
> to this project, is to have extremely long threads with no conclusion<br>
> as on the Squeak list.<br>
<br>
Indeed, although for what it's worth there's no lingering debate<br>
there on this particular issue[1]. ;)<br>
<br>
<br>
-C<br>
<br>
[1]<br>
<br>
Namely, the short form of...<br>
<br>
Array with: #foo with: #bar<br>
<br>
is...<br>
<br>
#(foo bar)<br>
<br>
as in Smalltalk-80, and the short form of...<br>
<br>
Array with: #foo with: true<br>
<br>
is...<br>
<br>
{#foo. true}</blockquote></div><div><br>Well, in Squeak 3.9 I get<br><br>Welcome to the finale version of 3.9 of 7 of November 2006<br>#(nil true false foo) collect: [:ea| ea class] {UndefinedObject . True . False . ByteSymbol}<br>
#(nil true false foo) printString '#(nil true false #foo)'<br><br></div><div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
But I suspect the appropriate standard use of curly brackets<br>
across multiple dialects is a whole other morass. :)</blockquote></div><div><br>Having been living with Squeak for a while now I really, really like the curly brace syntax. I also note that it doesn't conflict with e.g. VisualWorks use of #{name} for binding references. So I have a strong personal preference for it, but that's just personal.<br>
<br></div></div><br>
<br></div></div><div>_______________________________________________<br>
ANSI-Smalltalk mailing list<br>
<a href="mailto:ANSI-Smalltalk@lists.openskills.org" target="_blank">ANSI-Smalltalk@lists.openskills.org</a><br>
<a href="http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk" target="_blank">http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk</a><br>
<br></div></blockquote></div><br>
<br>_______________________________________________<br>
ANSI-Smalltalk mailing list<br>
<a href="mailto:ANSI-Smalltalk@lists.openskills.org" target="_blank">ANSI-Smalltalk@lists.openskills.org</a><br>
<a href="http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk" target="_blank">http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk</a><br>
<br></blockquote></div></div></div><br>
<br>_______________________________________________<br>
ANSI-Smalltalk mailing list<br>
<a href="mailto:ANSI-Smalltalk@lists.openskills.org" target="_blank">ANSI-Smalltalk@lists.openskills.org</a><br>
<a href="http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk" target="_blank">http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk</a><br>
<br></blockquote></div><br>
</div></div><br>_______________________________________________<br>
ANSI-Smalltalk mailing list<br>
<a href="mailto:ANSI-Smalltalk@lists.openskills.org" target="_blank">ANSI-Smalltalk@lists.openskills.org</a><br>
<a href="http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk" target="_blank">http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk</a><br>
<br></blockquote></div></div></div><br>
<br>_______________________________________________<br>
ANSI-Smalltalk mailing list<br>
<a href="mailto:ANSI-Smalltalk@lists.openskills.org">ANSI-Smalltalk@lists.openskills.org</a><br>
<a href="http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk" target="_blank">http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk</a><br>
<br></blockquote></div><br>