Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Type function is not smart enough
Message
From
25/10/2002 20:58:28
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00714883
Message ID:
00715703
Views:
18
This message has been marked as a message which has helped to the initial question of the thread.
>>Could be, but I think Hilmar's explanation is even more rational. It would be interesting to hear MS explanations about it. I'm almost sure, Hilmar is correct.
>
>As I pointed out in the Message #715374, his explanation is incorrect.

Hmmm.. I don't know about this. I just did a little test and found that in fact you're right that Type() is actually running the built-in function to get the return type, and not just checking the function name and parameter list.

I did it like this: Create an array a1[2,2] and fill it with whatever you like. Then create an empty array a2[2,2]

Then issue the following:
? Type("ACOPY(a1, a2)")
the result is 'N', and a2 now contains the same info as a1.

On the other hand, if VFP is happy doing that, then I have a little trouble believing that it's worried about 'performance' as the big issue. That could well have been a huge array, and Type() would still have happily run it. If it refuses to run UDF's then I have to believe that it is because it has no idea what the effect of running it will be, and not performance.

Now, having said that, does the programmer really want even the side effect of the above example just to get the return type? Probably not. Maybe it should refuse to work even on built-in types. After all the return types of those functions are documented and known.

My vote though, is still for 'side-effects' being the main issue.

Alan
Previous
Reply
Map
View

Click here to load this message in the networking platform