Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Programmatically changing Events at runtime
Message
From
26/07/1999 13:14:23
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00237998
Message ID:
00246170
Views:
16
>>The method you proposed is actually pretty commonplace (well, key parts of it anyway).
>
>I think your explanation puts a nice trick in the original poster's bag.
>
>Just installed SP3. Noticed in the docs that the COMPILE command can now be used in the Run-time version, so we can now (finally, after all these years) have an efficient way in our distributed apps to write code that writes code. Kind of sad, in a way: This capability renders obsolete some of the neatest tricks that I had in my bag.

The availability of COMPILE at runtime doesn't change the fact that WriteMethod() is only available at design time (for use by builders). You're right- being able to compile a program that was written at runtime can be very powerful- but IMHO, it's use is subject to some of the same bad design pitfalls that come with careless overuse of macro expansion (&lcSomeCommand). IOW, before designing a routine or set of routines that take advantage of COMPILE at runtime, carefully examine your requirements to see if you could more simply do the task with parameters or polymorphism.

BTW- one of the neatest pieces of code ever written IMHO, is Randy Pearson's CodeBlock- this program takes a program listing as a string parameter and parses it, deconstructing all of the conditional programming structures like IF, FOR/ENDFOR, CASE, and most others, and runs the entire program line by line using macro substitution. Before we had the ability to compile stuff at runtime, we had the ability to run most code already...
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform