[Swift-devel] New built-in system, request for comments

Michael Wilde wilde at anl.gov
Sat Apr 5 09:42:58 CDT 2014


Yadu and I discussed something similar (ie getting a separate return 
code as well). I agree, that would be good.

Mihael, is it possible for a built-in function to provide multiple returns?

How does one go about coding the built-in to behave context-sensitively 
to its return values? (Eg, I think as does readData?)
(Thats more of a question for whoever codes this).

Another question this raises is how one would write code that is 
sensitive to a failing function. This leads to the need for an exit() 
function that could shut down a swift run. And in the broader context it 
leads to the need for exception handling.

- Mike

On 4/4/14, 10:58 PM, Ketan Maheshwari wrote:
> Is it possible to handle stdout and/or stderr of system("command") 
> separately? That way, it might be useful in other places as well.
>
>
> On Fri, Apr 4, 2014 at 12:08 PM, Yadu Nand <yadudoc1729 at gmail.com 
> <mailto:yadudoc1729 at gmail.com>> wrote:
>
>     Hi,
>
>     I have just added a new builtin "system" to trunk. It takes a string,
>     which is executed in the shell
>     by java and the results are returned as an array. This is done to make
>     mappings easier, for example,
>     you can map an entire folder "foo" using the following :
>
>     file folder[ ] < array_mapper; files = system ("find foo -type f") >;
>
>     If the execution of the string provided fails, the logger would report
>     the the exitcode and stderr to
>     the swift stdout.
>
>     Thanks,
>     Yadu Nand B
>     _______________________________________________
>     Swift-devel mailing list
>     Swift-devel at ci.uchicago.edu <mailto: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

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-devel/attachments/20140405/8cb0a615/attachment.html>


More information about the Swift-devel mailing list