<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
There is a small piece missing from the history here that makes the
brace syntax make more sense.&nbsp; Up until Squeak 2.0, there was a
provision in Squeak to have a brace array as an lval in an assignment
as a form of multiple value return. For example:<br>
<br>
{a . b} := aPoint xyArray.<br>
<br>
where<br>
<br>
Point&gt;&gt;xyArray <br>
&nbsp;&nbsp;&nbsp; ^{ x . y}<br>
<br>
Some people feel that this reads better than:<br>
<br>
&nbsp;&nbsp;&nbsp; aPoint xyBlock: [ :x :y | a := x. b:= y]<br>
<br>
This is (as Eliot will recognize) essentially a very cut down version
of tuples and destructuring bind as implemented in a number of
functional languages. Gilad Bracha (Eliot's boss) wrote on such things
on his blog at <a class="moz-txt-link-freetext" href="http://gbracha.blogspot.com/2007/02/tuples.html">http://gbracha.blogspot.com/2007/02/tuples.html</a> and that
post is worth reviewing. He unfortunately abuses the term "literal" in
the post, as the brace syntax is better describes as a constructor that
is evaluated at run time.<br>
<br>
Cheers,<br>
&nbsp;-- John<br>
<br>
<br>
Eliot Miranda wrote:
<blockquote
 cite="mid:3ac5ce8a0803241845t61a26a7cw852b9c014b48f179@mail.gmail.com"
 type="cite"><br>
  <br>
  <div class="gmail_quote">On Mon, Mar 24, 2008 at 6:18 PM, Andres
Valloud &lt;<a moz-do-not-send="true"
 href="mailto:andres.valloud@gmail.com">andres.valloud@gmail.com</a>&gt;
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.&nbsp; Is that so?&nbsp; 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?&nbsp;
Because if so, it would be cheaper (and *sometimes* clearer) to do:<br>
    <br>
Bezier2Segment&gt;&gt;ellipseSegmentsDo: aBlock<br>
    <br>
&nbsp; aBlock<br>
&nbsp;&nbsp;&nbsp; value: seg1a;<br>
&nbsp;&nbsp;&nbsp; value: seg1b;<br>
&nbsp;&nbsp;&nbsp; value: seg2a;<br>
&nbsp;&nbsp;&nbsp; value: seg2b;<br>
&nbsp;&nbsp;&nbsp; value: seg3a;<br>
&nbsp;&nbsp;&nbsp; value: seg3b;<br>
&nbsp;&nbsp;&nbsp; value: seg4a;<br>
&nbsp;&nbsp;&nbsp; value: seg4b</blockquote>
  <div><br>
Um, semicolons aren't what you mean.&nbsp; You want a
Closure&gt;&gt;value:value:value:value:value:value:value:value: method
(right?), and there isn't one.&nbsp; You have to use valueWithArguments:.&nbsp;
But there isn't even an ArrayedCollection
class&gt;&gt;with:with:with:with:with:with:with:with: method to
construct one with(*).&nbsp; So once again a brace construct is the most
convenient way to implement
Closure&gt;&gt;value:value:value:value:value:value:value:value:.<br>
  <br>
(*) at least you can write ArrayedCollection
class&gt;&gt;with:with:with:with:with:with:with:with:.&nbsp; You can't write
Closure&gt;&gt;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.&nbsp; If you write it in terms of valueWithArguments: you still
need Array class&gt;&gt;with:with:with:with:with:with:with:with: to
construct the argument vector (or of course the convenient brace
construct).<br>
  <br>
  </div>
  <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><br>
Because sometimes things come in octets... <br>
  </div>
  <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 class="Wj3C7c"><br>
    <br>
    <br>
    <div class="gmail_quote">On Mon, Mar 24, 2008 at 6:09 PM, Eliot
Miranda &lt;<a moz-do-not-send="true"
 href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>&gt;
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 &lt;<a
 moz-do-not-send="true" href="mailto:andres.valloud@gmail.com"
 target="_blank">andres.valloud@gmail.com</a>&gt; 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.&nbsp; 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.&nbsp; 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&gt;&gt;makeEllipseSegments: aRectangle in Squeak V3.9
reads<br>
      <br>
&nbsp;&nbsp;&nbsp; ^{seg1a. seg1b. seg2a. seg2b. seg3a. seg3b. seg4a. seg4b}<br>
      <br>
instead of<br>
&nbsp;&nbsp;&nbsp; ^(Array with: seg1a with: seg1b with: seg2a with: seg2b),<br>
&nbsp; &nbsp;&nbsp;&nbsp; (Array with: seg3a with: seg3b with: seg4a with: seg4b)<br>
      <br>
BTW, the first example tat comes up in my image contains:<br>
&nbsp;&nbsp;&nbsp; {'zip'.'sar'.'pr'. 'mcz'. '*'} includes: suffix<br>
which is better written as<br>
&nbsp;&nbsp;&nbsp; #('zip' 'sar' 'pr' 'mcz' '*') includes: suffix<br>
so one can argue that it can be confusing for some to have two
apparently similar constructs.&nbsp; But in my experience {} carries its
weight (and there's no doubt that #() does).<br>
      <br>
      </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>On Tue, Mar 18, 2008 at 9:57 AM, Eliot Miranda &lt;<a
 moz-do-not-send="true" href="mailto:eliot.miranda@gmail.com"
 target="_blank">eliot.miranda@gmail.com</a>&gt; 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>On Mon, Mar 17, 2008 at 2:11 PM, Craig Latta &lt;<a
 moz-do-not-send="true" href="mailto:craig@netjam.org" target="_blank">craig@netjam.org</a>&gt;
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>
&nbsp;&gt; Defining new language elements is hard. &nbsp;The worst that could
happen<br>
&nbsp;&gt; to this project, is to have extremely long threads with no
conclusion<br>
&nbsp;&gt; as on the Squeak list.<br>
            <br>
&nbsp; &nbsp; &nbsp;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>
&nbsp; &nbsp; &nbsp;Namely, the short form of...<br>
            <br>
&nbsp; &nbsp; &nbsp;Array with: #foo with: #bar<br>
            <br>
is...<br>
            <br>
&nbsp; &nbsp; &nbsp;#(foo bar)<br>
            <br>
as in Smalltalk-80, and the short form of...<br>
            <br>
&nbsp; &nbsp; &nbsp;Array with: #foo with: true<br>
            <br>
is...<br>
            <br>
&nbsp; &nbsp; &nbsp;{#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;">&nbsp;
&nbsp;&nbsp; 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.&nbsp; I also note that it doesn't conflict with e.g.
VisualWorks use of #{name} for binding references.&nbsp; 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 moz-do-not-send="true"
 href="mailto:ANSI-Smalltalk@lists.openskills.org" target="_blank">ANSI-Smalltalk@lists.openskills.org</a><br>
          <a moz-do-not-send="true"
 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 moz-do-not-send="true"
 href="mailto:ANSI-Smalltalk@lists.openskills.org" target="_blank">ANSI-Smalltalk@lists.openskills.org</a><br>
        <a moz-do-not-send="true"
 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 moz-do-not-send="true"
 href="mailto:ANSI-Smalltalk@lists.openskills.org" target="_blank">ANSI-Smalltalk@lists.openskills.org</a><br>
      <a moz-do-not-send="true"
 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 moz-do-not-send="true"
 href="mailto:ANSI-Smalltalk@lists.openskills.org">ANSI-Smalltalk@lists.openskills.org</a><br>
    <a moz-do-not-send="true"
 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>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
ANSI-Smalltalk mailing list
<a class="moz-txt-link-abbreviated" href="mailto:ANSI-Smalltalk@lists.openskills.org">ANSI-Smalltalk@lists.openskills.org</a>
<a class="moz-txt-link-freetext" href="http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk">http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk</a>
  </pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 
John Dougan
<a class="moz-txt-link-abbreviated" href="mailto:jdougan@acm.org">jdougan@acm.org</a></pre>
</body>
</html>