[Swift-devel] [Bug 291] New: Add a exists() function to test for file existence

Michael Wilde wilde at mcs.anl.gov
Sat Apr 2 08:54:54 CDT 2011


Sounds good, John. Yes, there is a logical negation operator, "!":

com$ cat bool.swift
boolean b = true;

if(!b) {
  trace("its true");
} else {
  trace("its false");
}
com$ swift bool.swift
Swift svn swift-r3826 cog-r2988

RunID: 20110402-0854-r3p5rrqa
Progress:
SwiftScript trace: its false
Final status:
com$ 

- Mike

----- Original Message -----
> On Apr 1, 2011, at 12:25 PM, Michael Wilde wrote:
> 
> > John, I cc'ed you to confirm that the function is exactly what you
> > were looking for, and that the simple code below matches exactly the
> > requirement thats driving this feature request.
> >
> > Can you confirm that both of these are true?
> 
> Michael,
> 
> So assuming that there is a logical negation operator in Swift the
> function you describe matches my requirements.
> 
> Thanks,
> John
> 
> 
> > We just want to make sure that we understand the need and determine
> > if the proposed exists() function is the best way to address it.
> > From your comment below, I was not quite sure if exists() is exactly
> > the right approach here.
> >
> > Thanks,
> >
> > Mike
> >
> >
> > ----- Original Message -----
> >> Michael,
> >>
> >> This type of function would be great to have.
> >>
> >> John
> >> On Apr 1, 2011, at 11:51 AM, Michael Wilde wrote:
> >>
> >>> Basically as far as I understand: the presence or absence of a
> >>> particular data file within the inout dataset is to be used to
> >>> determine whether the code to process that dataset subsection gets
> >>> invoked or not:
> >>>
> >>> if (exists("extra.data")) {
> >>>    DataFile extraInput<"extra.data">;
> >>>    extraResult = analyze(extraInput);
> >>> }
> >>>
> >>> The above is my assumption based on a phone call. We can and
> >>> should
> >>> verify the assumption with a simple example.
> >>>
> >>> I also thought we can try this today by seeing if extraInput can
> >>> be
> >>> an array, mapped to zero items if nothing to do and 1 item if
> >>> something to do. That would at least let us test the use case.
> >>>
> >>> John, can you verify if the example Swift lines above are what you
> >>> are looking for here?
> >>>
> >>> - Mike
> >>>
> >>> ----- Original Message -----
> >>>> On Fri, 2011-04-01 at 10:51 -0500, Michael Wilde wrote:
> >>>>
> >>>>> - we should first verify that exists() will solve the NCAR need
> >>>>> in
> >>>>> a
> >>>>> sufficiently clean way
> >>>>
> >>>> I think this is important. Can we get a description of the
> >>>> problem
> >>>> instead of a (otherwise) random proposal for a solution?
> >>>
> >>> --
> >>> Michael Wilde
> >>> Computation Institute, University of Chicago
> >>> Mathematics and Computer Science Division
> >>> Argonne National Laboratory
> >>>
> >
> > --
> > Michael Wilde
> > Computation Institute, University of Chicago
> > Mathematics and Computer Science Division
> > Argonne National Laboratory
> >

-- 
Michael Wilde
Computation Institute, University of Chicago
Mathematics and Computer Science Division
Argonne National Laboratory




More information about the Swift-devel mailing list