[Swift-devel] strange behavior evaluating function call as trace arg

Michael Wilde wilde at mcs.anl.gov
Thu Feb 5 09:49:31 CST 2009


I dont understand this - can you clarify?

I understand an "lvalue" in swift to be one of:
- a var (eg var=value)
- an array element (eg a[i]=value)
- a struct element (eg s.a=value)

But swift procedures do indeed return a list of values, right?

Does the problem stem from the list-nature of the swift procedure 
return? (Ie, when a proc returns multiple values, it "needs" an set of 
lvalues on the lhs of an assignment statement to put them in, and this 
is currently enforced even in the case of a single value?  Wile an 
@function() returns a single value, and hence works?)

So below when you say "Procedure calls *must* have an lvalue to their l 
to give them somewhere to put their l" do you mean "Procedure calls can 
only be invoked form assignment statements, and *must* have the same 
number of lvalues on the lhs of the assignment to give them somewhere to 
put all of their return values" ???

On 2/4/09 7:29 PM, Ben Clifford wrote:
>> Looks like most nested invocations are broken, not specifically trace.
> 
> They're not 'broken'. If you think they should work, you're thinking far 
> too much along the lines of procedure calls evaluating to a value like 
> some kind of referentially transparent thing. Procedure calls *must* have 
> an lvalue to their l to give them somewhere to put their l. That's been 
> the case forever in Swift and in VDL2. Making that not happen is a long 
> term goal of mine, but its not in the language now.
> 



More information about the Swift-devel mailing list