[Swift-devel] Is the use of args within functions legal?
Mihael Hategan
hategan at mcs.anl.gov
Thu Sep 19 01:50:52 CDT 2013
Should now be fixed in svn.
There were two issues. One was that in trunk the value parameter to
arg() was not optional. I changed that back.
The other was that a missing positional parameter in karajan was not
well detected at run-time. In this case it was picking up stuff that was
left on the stack from other invocations. This should also be fixed.
This should have been caught by the swift compiler, but it was set to
treat the second parameter to arg() as optional, so it fell through the
cracks.
Mihael
On Wed, 2013-09-18 at 14:03 -0700, Mihael Hategan wrote:
> On Wed, 2013-09-18 at 15:17 -0500, Yadu Nand wrote:
> > Sorry Mihael, I've pasted the error below.
> > Why does the error go away, when the string assignment statements are
> > reversed in order?
>
> I assume because there is a string value on the stack frame from the
> previous invocation that the second invocation interprets as being the
> second argument. Or something like that.
>
> >
> > swift args_trunk.swift -foo="helloFOO"
> > Swift trunk swift-r7073 (swift modified locally) cog-r3787 (cog modified
> > locally)
> > RunID: 20130918-2014-t0fyb8m1
> > [Error] sites.xml, line 1, col 9: cvc-elt.1: Cannot find the declaration of
> > element 'config'.
> > Progress: time: Wed, 18 Sep 2013 20:14:29 +0000
> >
> > Execution failed:
> > java.lang.ClassCastException: Invalid type: expected a
> > org.griphyn.vdl.mapping.AbstractDataNode but got a
> > org.globus.cog.karajan.analyzer.InvalidArgChannel
> > swiftscript:arg @ args_trunk, line: 22
> > Caused by: java.lang.ClassCastException: Invalid type: expected a
> > org.griphyn.vdl.mapping.AbstractDataNode but got a
> > org.globus.cog.karajan.analyzer.InvalidArgChannel
> > at org.griphyn.vdl.karajan.lib.swiftscript.FnArg.function(FnArg.java:63)
> > at
> > org.griphyn.vdl.karajan.lib.SwiftFunction.runBody(SwiftFunction.java:108)
> > at
> > org.globus.cog.karajan.compiled.nodes.InternalFunction.run(InternalFunction.java:154)
> > at
> > org.globus.cog.karajan.compiled.nodes.CompoundNode.runChild(CompoundNode.java:87)
> > at
> > org.globus.cog.karajan.compiled.nodes.InternalFunction.run(InternalFunction.java:147)
> > at
> > org.globus.cog.karajan.compiled.nodes.CompoundNode.runChild(CompoundNode.java:87)
> > at
> > org.globus.cog.karajan.compiled.nodes.Sequential.run(Sequential.java:22)
> > at
> > org.globus.cog.karajan.compiled.nodes.CompoundNode.runChild(CompoundNode.java:87)
> > at
> > org.globus.cog.karajan.compiled.nodes.UParallel$1.run(UParallel.java:68)
> > at k.thr.LWThread.run(LWThread.java:228)
> > at
> > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> > at
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> > at java.lang.Thread.run(Thread.java:722)
> >
> > -Yadu
> >
> >
> >
> > On Wed, Sep 18, 2013 at 3:11 PM, Mihael Hategan <hategan at mcs.anl.gov> wrote:
> >
> > > 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
> > >
> > >
> > >
> >
> >
> > Sorry Mihael, I've pasted the error below.
> >
> > Why does the error go away, when the string assignment statements are
> > reversed in order?
> >
> >
> > swift args_trunk.swift -foo="helloFOO"
> > Swift trunk swift-r7073 (swift modified locally) cog-r3787 (cog
> > modified locally)
> > RunID: 20130918-2014-t0fyb8m1
> > [Error] sites.xml, line 1, col 9: cvc-elt.1: Cannot find the
> > declaration of element 'config'.
> > Progress: time: Wed, 18 Sep 2013 20:14:29 +0000
> >
> > Execution failed:
> > java.lang.ClassCastException: Invalid type: expected a
> > org.griphyn.vdl.mapping.AbstractDataNode but got a
> > org.globus.cog.karajan.analyzer.InvalidArgChannel
> > swiftscript:arg @ args_trunk, line: 22
> > Caused by: java.lang.ClassCastException: Invalid type: expected a
> > org.griphyn.vdl.mapping.AbstractDataNode but got a
> > org.globus.cog.karajan.analyzer.InvalidArgChannel
> > at
> > org.griphyn.vdl.karajan.lib.swiftscript.FnArg.function(FnArg.java:63)
> > at
> > org.griphyn.vdl.karajan.lib.SwiftFunction.runBody(SwiftFunction.java:108)
> > at
> > org.globus.cog.karajan.compiled.nodes.InternalFunction.run(InternalFunction.java:154)
> > at
> > org.globus.cog.karajan.compiled.nodes.CompoundNode.runChild(CompoundNode.java:87)
> > at
> > org.globus.cog.karajan.compiled.nodes.InternalFunction.run(InternalFunction.java:147)
> > at
> > org.globus.cog.karajan.compiled.nodes.CompoundNode.runChild(CompoundNode.java:87)
> > at
> > org.globus.cog.karajan.compiled.nodes.Sequential.run(Sequential.java:22)
> > at
> > org.globus.cog.karajan.compiled.nodes.CompoundNode.runChild(CompoundNode.java:87)
> > at org.globus.cog.karajan.compiled.nodes.UParallel
> > $1.run(UParallel.java:68)
> > at k.thr.LWThread.run(LWThread.java:228)
> > at
> > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> > at java.util.concurrent.ThreadPoolExecutor
> > $Worker.run(ThreadPoolExecutor.java:615)
> > at java.lang.Thread.run(Thread.java:722)
> >
> >
> > -Yadu
> >
> >
> >
> >
> >
> > On Wed, Sep 18, 2013 at 3:11 PM, Mihael Hategan <hategan at mcs.anl.gov>
> > wrote:
> > 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
> >
> >
> >
> >
> >
> >
> > --
> > Yadu Nand B
> >
> >
>
>
> _______________________________________________
> 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