Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CLR and VFP
Message
De
02/09/2000 17:08:03
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00409695
Message ID:
00412105
Vues:
22
>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

>and things like full commands.

Well, if you've followed the rest of my argument here, you know that I feel that we should have commands that take expressions to handle most of this stuff (SETs and SQL), but you're right, if you're storing code is memo fields and properties, there's no substitute.

>As far as Eval() and Macros go - they're in the same vein. You don't have eval in other languages either although in a P-COde environmnet like VB and CLR it should be possible to do.

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...

>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

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 guess this just restates my argument that with few exceptions, macros are only powerful because our language is, in a sense, incomplete.
Erik Moore
Clientelligence
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform