Ken,

First question is Which method is throwing the error, the one in MyObject or 
the one in 
MyOtherObject that creates the third parameter?

In MyOtherObject.Method, what happens with NULLs?  You said it might return a 
string 
or an integer, so you must be checking for type somewhere.  What if the field 
it's
looking at contains a NULL?  That's not the same as EMPTY().

Dan Covill

----------------------------------------
> Date: Tue, 7 Jul 2015 12:11:54 -0400
> To: [email protected]
> From: [email protected]
> Subject: Pass a Method to a Method?
>
> Here's an odd one:
>
> Today, in my VFP 9 SP1 production .exe, my error logger reported VFP Error
> 11 ("Function argument value, type, or count is invalid.") on a call from a
> form like this:
>
> MyForm.MyMethod:
>
> BooleanResult =
> oMyObject.Method(THISFORM,"specifictablename",oMyOtherObject.Method("fieldname"))
> ** end method**
>
> This system has been in operation since late 2007. I normally have zero
> problems passing methods as parameters to other methods, so this surprised me.
>
> The data types of the passed variables are not really relevant:
>
> oMyOtherObject.Method() may return an empty string or an integer greater
> than 0.
>
> oMyObject.Method() doesn't validate the parameters, but when
> oMyObject.Method() receives "specifictablename" as the second parm, it
> calls another method of oMyObject that will return .T. if the type of data
> returned by oMyOtherObject.Method() is an EMPTY() value of any type, and
> then passes that boolean .T. value back.
>
> In addition, the stack trace shows the error occurring on the
> oMyObject.Method() call, not any of the methods lower down, and the error
> is not "data type mismatch". This would seem to suggest that VFP, in this
> one isolated instance. hiccupped on a method passed as a parameter.
>
> Again, I've NEVER seen this before in the entire 8 year history of this
> application. What could account for this? Could there be some kind of
> timing issue involved in the resolution of the method call passed as a
> parameter?
>
> Is passing a method as a parameter to another method an official no-no in VFP?
>
> As a precaution, I've separated out the oMyOtherObject.Method() call and
> let it populate a variable that I now pass to oMyObject.Method().
>
> But I find this interesting, and strange, and I wonder if anyone else has
> seen this.
>
> Thanks.
>
> Ken Dibble
> www.stic-cil.org
>
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to