[Swift-devel] Is the use of args within functions legal?

Mihael Hategan hategan at mcs.anl.gov
Wed Sep 18 15:11:07 CDT 2013


Ok, the error is due to the optional value missing. There's shouldn't be
an error to begin with, but a temporary workaround is:

string FOO = arg("foo", "defaultValue")

On Wed, 2013-09-18 at 14:44 -0500, Yadu Nand wrote:
> Ketan reported a script failing for him on trunk alone and this is the
> condensed
> form of his script that fails consistently on trunk:
> 
> func() {
>     string FOO=arg("foo");
>     string BAR="hello";
>     tracef("FOO : %s  | BAR : %s\n", FOO, BAR);
> }
> func();
> 
> This script does pass on 0.94RC3, but not on Trunk. Could someone confirm
> if this
> is valid syntax ?
> 
> Reversing the order of the assignments to the following, gets the test to
> pass:
> 
> func() {
>     string BAR="hello";
>     string FOO=arg("foo");
>     tracef("FOO : %s  | BAR : %s\n", FOO, BAR);
> }
> func();
> 
> 
> ​Thanks,​
> 
> Yadu
> Ketan reported a script failing for him on trunk alone and this is the
> condensed 
> 
> form of his script that fails consistently on trunk:
> 
> func() {
>     string FOO=arg("foo");
>     string BAR="hello";
>     tracef("FOO : %s  | BAR : %s\n", FOO, BAR);
> }
> func();
> 
> 
> This script does pass on 0.94RC3, but not on Trunk. Could someone
> confirm if this 
> 
> is valid syntax ?
> 
> 
> Reversing the order of the assignments to the following, gets the test
> to pass:
> 
> func() {
>     string BAR="hello";
>     string FOO=arg("foo");
>     tracef("FOO : %s  | BAR : %s\n", FOO, BAR);
> }
> func();
> 
> 
> 
> 
> ​Thanks,​
>  
> Yadu
> _______________________________________________
> Swift-devel mailing list
> Swift-devel at ci.uchicago.edu
> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel





More information about the Swift-devel mailing list