On 3-Oct-06, at 4:19 PM, Kevin Windham wrote:
On Oct 3, 2006, at 11:33 AM, [EMAIL PROTECTED] wrote:
You could use a dictionary. First, store your values from your
config file into a dictionary, and then copy them to your local
variables, if you so desire.
...
I don't see how this will save me much work. I still have to create
code for every possible value it seems. I mean I already have
objects with named properties, there has to be some smart way to
take something like car.maxspeed = 248 from a config file and get
it into a car object with a maxspeed property. This would be simple
in javascript.
You can use Operator_Lookup to create "properties" at runtime using a
dictionary as storage, but it can't be used to shadow real
properties. The Operator_Lookup approach isn't ideal for performance
critical reads/writes but does provide a lot of flexibility - e.g.
once set up, you can add a new key pair to your config and
automatically use it in your code with no further effort. It does
have the side effects of no autocomplete and never catching undefined
errors (though you can generate runtime errors for the later).
Frank.
<http://developer.chaoticbox.com/>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>