[Swift-devel] Minor question about semantics

Mihael Hategan hategan at mcs.anl.gov
Thu Oct 18 14:07:34 CDT 2012


I'll add that at least at one point we discussed the fact that the
symbol "@" as a mechanism to distinguish between an app/compound and a
built-in function is not really necessary (and a bit distasteful), as
well as limiting (one may want to be able to have user-defined functions
that can be invoked as part of the app command line).

Mihael

On Thu, 2012-10-18 at 13:58 -0500, Michael Wilde wrote:
> 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
> 





More information about the Swift-devel mailing list