Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CLR and VFP
Message
 
To
02/09/2000 17:08:03
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00409695
Message ID:
00412193
Views:
23
>>I use EVAL() whenever I can but EVAL() can't handle a few things like assignments (ie. the left side of an assigment)
>
>x= "y"
>STORE 123 TO (x)
>?y && displays 123

Interesting... End result is probably slower that way though...

>Is there a reason its not done in VB? I know VBA has an EVAL function, but VBA is compiled at runtime. EVAL() doesn't use the compiler like macros do, so it should be possible...

Don't know. But I remember demonstrating a few examples a few years back to some Microsoft folks, and they just didn't understand the concept at all. So my guess it's part ignorance, part (in hteir minds anyway) need to have it.


>>I really can't imaging writing framework level code without eval - which means you'd end up hardcoding a lot of things (like field names and properties).
>
>But this could be handled with a SetProperty method that takes a property name and a value. As far as data goes, VFP is a little unique in that field names need to be literal. In an object data environment (ADO), you can put an expression in when accessing a field:
>
>lcField = "LastName"
>?oRS.Fields(lcField).Value

Yes, but that requires an object in placve that provides that info. Then there's objects and you can't walk that easily.

>
>So the end effect is the same as EVAL or a macro.
>
>>Think about a tool like wwXML - without eval you couldn't do what it does...
>
>See above. You're right, with the current state of things in VFP you couldn't do without EVAL, but you could build a tool in VB that does what wwXML does for data because it would operate on a recordset, and a recordset allows access to fields with an expression. I don't know VB well enough to know if the functions exist, but a simple set of AddProperty, GetProperty and SetProperty functions would allow you to do the wwXML object stuff in VB without the benefit of EVAL or macros.

I've never heard of any tool that has something like AddProperty actually unless its a meta data repository that holds these added values. That's yet another extremely useful feature.

However, I agree with you - if the language made available proper type discovery information along with access methods to dynamically get at fields/properties I think I could live with eval after all. Those tend to be the main things that I use this stuff for, but I use it extensively. I haven't checked C# and CLR but I think in fact type discovery (and persistence of just about everything into XML) is part of that language.

+++ Rick ---
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Reply
Map
View

Click here to load this message in the networking platform