[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: _ref_extra

"Pavel A. Romashkin" wrote:
> Oh well. Just thought I'd ask. I got around it after all, although it
> took me extra 20 lines of code. Basically, I did not want to write
> get_property methods the old way anymore, inspired by David's complaint
> that then you have to revisit them every time you need to alter the
> object.  I have one get_property for everything now, and it works :-)
> Thank you,
> Pavel

And do you mind sharing it?  I once did this (in the pre-_REF_EXTRA
days) by changing GetProperty to a function, returning a structure with
keyword:value pairs, and chaining down the inheritance tree by
concatenating the structures returned.  I abandoned it when _REF_EXTRA

Despite the inconvenience, GetProperty as it is does have one thing in
its favor: if you just allow those fields to be "gotten" that you won't
mind keeping the same, you can isolate yourself from your own (OK, my
own) tendency to perform quick-fixes by digging deeper than you should. 
My recommendation: only add GetProperty keywords when you run into the
first time you actually *need* that value, and even then spend some time
convincing yourself that you're happy to fix that field in stone, no
matter what other changes the remainder of the class undergoes.