On Tue, 12 May 2015, Sven Schreiber wrote:
a tricky situation:
<hansl>
function void hey(matrix mm)
string huhu = argname(mm)
slen = strlen(huhu)
print slen
end function
bundle bc = null
matrix bc.m = zeros(3,2)
hey(bc.m)
</hansl>
The length of the argname(mm) result string is zero. According to
the argname doc, this happens if the argument was passed
"anonymously". I understand that it's not really clear what the
argname of bc.m should be, being a member of a bundle. However, this
limitation is kind of unsatisfactory IMO, because I'm passing the
correct parameter type to the function, but then it breaks down
because the parameter happens to come from inside a bundle, which
should be irrelevant from the point of view of the function.
I don't really see why this is unsatisfactory. The bundle-member
doesn't have a name as such (it does have a key, but it could be
misleading to offer that via argname()).
Yes, you're passing an argument of the correct type, and you'll be
able to do anything matrix-y with it inside the function, but it's
just not a named object in its own right so you don't get a non-empty
argname. The same would go for passing, e.g., "ones(2,2)" or "inv(A)"
or whatever.
Allin