[Swift-devel] Minor question about semantics

Michael Wilde wilde at mcs.anl.gov
Thu Oct 18 13:58:10 CDT 2012


Tim, here's what I think the answers are, but others should verify what I say here.

> Is there any difference between @x and @filename(x) in an app command
> line? E.g.
> 
> app (binaryfile bf) myproc (int i, string s="foo") {
> myapp i s @filename(bf);
> }
> 
> versus
> 
> app (binaryfile bf) myproc ( int i, string s= "foo" ) {
> myapp i s @ bf;
> }

These should behave identically, except that I don't know if lexically one can leave a space between @ and the variable (i.e. I think it needs to be @bf vs @ bf). I assume you weren't asking about the space.

The place where I believe that @bf and @filename(bf) behave differently is that the shorthand @bf is not accepted syntactically everywhere. I thought we have an open ticket on this but I cant locate it.

We need to test, but I think @f doesn't work in ordinary expressions, where you would expect it to be equivalent to @filename(f). I.e. it only works on an app() command line template.

I think that @f should always be identical to @filename(f) in all cases. If we deprecate the use of @ as a prefix for intrinsic functions (as I agree we should) then we perhaps want to retain the use of @f as a syntactic shorthand for filename(f).

In swift/t, for a transition period, can we just ignore the @ in all expressions of the form @fname(args)? Perhaps with a deprecation warning?

> Also, what is the intended behaviour if you omit the @ in front of the
> variable name? Is this valid? E.g.
> 
> app (binaryfile bf) myproc ( int i, string s= "foo" ) {
> myapp i s bf;
> }

As I recall this inserts a string representation of the file object on the command line, as if one is doing a tracef() on the file object instead of its mapped filename string.

That seems a somewhat useful behavior for debugging but is seldom what you want to running an app() command.

- Mike

> 
> Cheers,
> Tim
> 
> _______________________________________________
> Swift-devel mailing list
> Swift-devel at ci.uchicago.edu
> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel

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




More information about the Swift-devel mailing list