[Swift-devel] Swift arrays
Michael Wilde
wilde at mcs.anl.gov
Wed Apr 3 18:04:09 CDT 2013
Ketan will explain more, but the problem here seems to be one of case-insensitive names.
In:
foreach b,i in B{
b and B seem to be referring to the same variable, hence the Invalid Path message.
I vaguely recall an older discussion about variable name case sensitivity. What was the latest implementation decision on that?
For example, if I declare a and A as variables, I get an "already defined" error, but in the case of the implicit variable declaration of the foreach loop vars, this seems to work differently.
- Mike
----- Original Message -----
> From: "Ketan Maheshwari" <ketancmaheshwari at gmail.com>
> To: "Swift Devel" <swift-devel at ci.uchicago.edu>
> Sent: Wednesday, April 3, 2013 4:20:33 PM
> Subject: [Swift-devel] Swift arrays
>
>
>
> Trying to get some arithmetic done over arrays. I was testing a
> simple Swift script as follows:
>
>
>
> int A[] = [1,1,1];
> int B[] = [2,2,2];
>
>
> foreach b,i in B{
> tracef("A[%i] is %i.\n",i, A[i]);
> tracef("B[%i] is %i.\n",i, B[i]);
> }
>
>
>
> Progress: time: Wed, 03 Apr 2013 17:18:13 -0400
> A[2] is 1.
> A[0] is 1.
> A[1] is 1.
> Execution failed:
> org.griphyn.vdl.mapping.InvalidPathException: Invalid path ([1]) for
> B[1]:int = 2 - Closed
> swiftscript:tracef, test.swift, line 6
>
>
> Wondering if this should fail and why.
>
>
> Thanks,
> --
> Ketan
>
>
> _______________________________________________
> 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