[Swift-devel] Nasty multiparameter function hack.

Mihael Hategan hategan at mcs.anl.gov
Wed Apr 25 10:06:08 CDT 2007


On Wed, 2007-04-25 at 14:53 +0000, Ben Clifford wrote:
> 
> On Wed, 25 Apr 2007, Mihael Hategan wrote:
> 
> > On Wed, 2007-04-25 at 08:32 +0000, Ben Clifford wrote:
> > > However, where the parameter is a variable:
> > > 
> > >   @f(x)
> > > 
> > > this turned into a Karajan function call with two parameters, a 'variable' 
> > > and a 'path'. In the above case, the variable is x and the path is empty.
> > > 
> > > In the case of @f(x.y) then the variable would be x and the path would be 
> > > y.
> > 
> > That's kinda wrong:
> > @f(x) should be f(getfield(x, path="")) which can be reduced to f(x) and
> > @f(x.y) should be f(getfield(x, path="y")).
> > 
> > Consequently:
> > @strcat("x", x) -> strcat("x", x)
> > @strcat("x", x.y) -> strcat("x", getfield(x, path="y"))
> 
> Does getfield still pass through enough info for something like 
> @filename(x.y) to work?

it should be the same as
tmp = x.y;
@filename(tmp);

So yes. In contrast to getFieldValue, it does not unwrap things.

> 
> I haven't really done anything with getfield ever.
> 




More information about the Swift-devel mailing list