[Swift-devel] Swift arrays
Mihael Hategan
hategan at mcs.anl.gov
Wed Apr 3 21:57:39 CDT 2013
Seems that you are correct (despite the error message printing the
correct type for B): if I say foreach c,..., it finishes fine.
I'm wary of fixing this in 0.94, so that leaves trunk. But then if we
merge the faster branch to trunk, that problem won't be there any more
since things are case-sensitive there.
Let me know what you think.
Mihael
On Wed, 2013-04-03 at 18:04 -0500, Michael Wilde wrote:
> 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
> >
> _______________________________________________
> 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