[Swift-devel] unitialized error when swift app returning a non-file type

Ketan Maheshwari ketancmaheshwari at gmail.com
Mon Apr 1 21:26:17 CDT 2013


I was thinking Swift would take a placeholder for 'r' which would be a
command line arg and would expect the placeholder be filled with value in
the app call. However, I agree that in this example it would be counter
intuitive and perhaps unsuitable.

Does this mean that a Swift app can only return a file type?


On Mon, Apr 1, 2013 at 4:49 PM, Mihael Hategan <hategan at mcs.anl.gov> wrote:

> What do you think should appear on the command line for echo in the
> following case:
>
> app (string r) f() {
>   echo r;
> }
>
> string s;
> s = f();
> ?
>
> Mihael
>
> On Mon, 2013-04-01 at 16:33 -0500, Ketan Maheshwari wrote:
> > Consider the following variant of above example:
> >
> > type file;
> >
> > app (file _b) s_app(string a){
> >  str_app a @_b;
> > }
> >
> > file b[]<simple_mapper; location=".", prefix="b_",suffix=".out">;
> >
> > foreach i in [0:10]{
> >    b[i]= s_app("hello");
> > }
> >
> > And the corresponding bash script that app links to:
> >
> > #!/bin/bash
> >
> > echo "$1">$2
> >
> > This variant exhibits the same pattern as the previous one except that b
> > now is a file type variable. The original example which did not work
> > involved b as a non-file type variable (string).
> >
> > Since this one works, I understood the one with other types should also
> > work.
> >
> >
> >
> > On Mon, Apr 1, 2013 at 4:23 PM, Mihael Hategan <hategan at mcs.anl.gov>
> wrote:
> >
> > > On Mon, 2013-04-01 at 16:18 -0500, Ketan Maheshwari wrote:
> > > > To my understanding, it has to be used in the commandline so that
> Swift
> > > > knows where to put its value.
> > >
> > > I'm not sure what you mean there, or where you got that information,
> but
> > > when you say
> > >
> > > app ... {
> > >   appname x;
> > > }
> > >
> > > that means invoke 'appname' with the value of x as a parameter on the
> > > command line. There is no such value if x is a return parameter.
> > >
> > > Mihael
> > >
> > >
> > >
> >
> >
> > Consider the following variant of above example:
> >
> >
> > type file;
> >
> >
> > app (file _b) s_app(string a){
> >  str_app a @_b;
> > }
> >
> >
> > file b[]<simple_mapper; location=".", prefix="b_",suffix=".out">;
> >
> >
> > foreach i in [0:10]{
> >    b[i]= s_app("hello");
> > }
> >
> >
> > And the corresponding bash script that app links to:
> >
> >
> > #!/bin/bash
> >
> >
> > echo "$1">$2
> >
> >
> > This variant exhibits the same pattern as the previous one except that
> > b now is a file type variable. The original example which did not work
> > involved b as a non-file type variable (string).
> >
> >
> > Since this one works, I understood the one with other types should
> > also work.
> >
> >
> >
> >
> > On Mon, Apr 1, 2013 at 4:23 PM, Mihael Hategan <hategan at mcs.anl.gov>
> > wrote:
> >         On Mon, 2013-04-01 at 16:18 -0500, Ketan Maheshwari wrote:
> >         > To my understanding, it has to be used in the commandline so
> >         that Swift
> >         > knows where to put its value.
> >
> >
> >         I'm not sure what you mean there, or where you got that
> >         information, but
> >         when you say
> >
> >         app ... {
> >           appname x;
> >         }
> >
> >         that means invoke 'appname' with the value of x as a parameter
> >         on the
> >         command line. There is no such value if x is a return
> >         parameter.
> >
> >         Mihael
> >
> >
> >
> >
> >
> >
> > --
> > Ketan
> >
> >
>
>
>


-- 
Ketan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-devel/attachments/20130401/644b1a5b/attachment.html>


More information about the Swift-devel mailing list