<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix"><br>
      There's also this compact style:<br>
      <br>
      foo bar(1,2);<br>
      <br>
      Is it ambiguous?  C++ has issues with this.<br>
      <br>
      On 02/03/2015 04:54 PM, Tim Armstrong wrote:<br>
    </div>
    <blockquote
cite="mid:CAC0jiV7MWtGmm60nHHZo7_58O3AVatx8hCOJBFpvx=X3DgShjQ@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <div dir="ltr">
        <div>
          <div>
            <div>Hi All,<br>
            </div>
              While designing a location-aware feature for Swift/T
            Justin and I came across a scenario where we wanted to use
            Swift structs, but where it was very painful to assign each
            element individually.  To give you an idea:<br>
            <br>
            type foo {<br>
          </div>
            int x;<br>
        </div>
          int y;<br>
        <div>
          <div>}<br>
            <br>
          </div>
          <div>foo bar;<br>
            bar.x = 1;<br>
            bar.y = 2;<br>
            <br>
          </div>
          <div>I'm looking at adding a feature where we can fill in a
            structs fields with a single expression.<br>
            <br>
          </div>
          <div>We could do them the C-style way, but that doesn't allow
            us to use them without defining a new variable (the issue is
            that {} doesn't specify the intended type, meaning it needs
            to come from context):<br>
            <br>
          </div>
          <div>foo bar = { 1, 2 };<br>
            <br>
          </div>
          <div>I was thinking  that we should just have types function
            as named constructor functions.  There's precedent both in
            object-oriented languages and with Haskell's algebraic data
            types.  Now you can just use this expression wherever
            needed:<br>
            <br>
            foo(1, 2)<br>
            <br>
          </div>
          <div>Thoughts?  I'm reluctant to add new incompatibilities
            with Swift/K, but this seems like it would be really clunky
            otherwise.<br>
            <br>
          </div>
          <div>- Tim<br>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Swift-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Swift-devel@ci.uchicago.edu">Swift-devel@ci.uchicago.edu</a>
<a class="moz-txt-link-freetext" href="https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel">https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel</a>
</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Justin M Wozniak</pre>
  </body>
</html>