Hi Paul > ------------------------------ > > Message: 8 > Date: Fri, 30 Nov 2007 14:28:42 -0800 > From: Paul McNett <[EMAIL PROTECTED]> > Subject: Re: Setting property value at runtime > To: [EMAIL PROTECTED] > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset="us-ascii" > > Paul McNett wrote: > > > Christof Wollenhaupt wrote: > > > >> obj.AddProperty(cPropertyName,eNewValue) > >> > >> not that is more readable, but certainly more oopy. <g> > > > > But I'm not adding a property; the property already exists. > > ...I see that it works though. This is better in my opinion because it > doesn't rely on runtime evaluation to get object references. Thanks for > pointing out that AddProperty() can set a property value even if the > property exists. I would have expected an error "Property already > exists" if you tried to add it again, but I'm thinking in Python I guess.
I wrote an article: http://my.advisor.com/doc/17117 in which I suggest that if we make code comprehensible it will be better in the long run. I chose coherence for it's meaning (http://m-w.com/dictionary/coherent) of understandability and for the idea that a UDF's code should stick to the purpose of the UDF. I'd like to suggest you re-consider your preference. One is more 'OOPy', yet you'd expect it to error out. That makes the code incoherent, IMO. > >> obj.AddProperty(cPropertyName,eNewValue) This one is clearly and concisely doing exactly what you wanted. > > Store eNewValue to ("obj."+cPropertyName) My two cents (Canadian). :) _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

