title: Using Swift struct Constructor as Function
body: <p>Given a <code>struct S</code> defined in this way</p>
  
  <pre><code>struct S {
      let a : String 
      let b : Int 
      let c : Bool 
  }
  </code></pre>
  
  <p>and a function <code>sConstructorFun</code></p>
  
  <pre><code>func sConstructorFun(#a:String, #b:Int, #c:Bool) -&gt; S { 
      return S(a:a, b:b, c:c) 
  }
  </code></pre>
  
  <p>I can use both <code>sConstructorFun(a:"", b:1, c:false)</code> and <code>S(a:"", b:1, c:false)</code> to get the following <code>S</code> value (as the REPL outputs it)</p>
  
  <pre><code>S = {
    a = ""
    b = 1
    c = false
  }
  </code></pre>
  
  <p>So <code>S</code> and <code>sConstructorFun</code> have the very same interface and unsurprisingly return the same result.</p>
  
  <p>However, a <code>sFactory</code> function defined as follows</p>
  
  <pre><code>func sFactory(f:(String, Int, Bool) -&gt; S) -&gt; S {
      return f("foo", 42, false) 
  }
  </code></pre>
  
  <p>can only be used with the <code>sConstructorFun</code> but <em>not</em> with <code>S</code> directly:</p>
  
  <pre><code>REPL&gt; sFactory(sConstructorFun) 
  $R2: S = {
    a = "foo"
    b = 42
    c = false
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>REPL&gt; sFactory(S) 
  repl.swift:18:1: error: cannot invoke 'sFactory' with no arguments
  sFactory(S)
  ^
  repl.swift:18:9: note: expected an argument list of type '((String, Int, Bool) -&gt; S)'
   sFactory(S)
           ^
  </code></pre>
  
  <p>Is there any way of using the default constructor of a <code>struct</code> (<code>S</code> in this example) as a function (without defining a new function/closure to do so)?</p>