From: Robert Date: 2003-04-29T16:28:37+09:00 Subject: Re: How to undefine a member variable ? (or at least hide it from YAML) "Simon Vandemoortele" schrieb im Newsbeitrag news:KEfra.66049$t_2.6111@afrodite.telenet-ops.be... > On Mon, 28 Apr 2003 at 06:16 GMT, Robert wrote: > > > What strikes me as odd with your design is, that there are so many unused > > member variables. Shouldn't the contining instances be unused? Shouldn't > > you make more use of temporary instances that do some work and disappear > > again? I don't know the circumstances of your code but I'd think that empty > > variables are usually no problem. Maybe you can improve your design to get > > rid of all the unused stuff. > > I am coding an Addressbook container class that contains Contacts. All > contacts have many possible fields like: > "name","comment","birthday","url", etc ... > Many of these are uncommon and will not be used by many people so they > should not appear as empty definitions in my YAML dump _even if someone > once assigned a value to it but then discarded it_. > > Does that clarify the situation ? Yes, indeed. Thinking about this, did you check what happens to the yaml output if you do a dup before writing? I don't know about the implementation but maybe this helps. > PS: Actually I have an interesting question about the design of > the addressbook's interface but I am afraid to post it here lest it > be considered off-topic since it's not a specific ruby problem. I wouldn't bother asking this here since it's not too seldom that those questions are discussed here and at least there might be a bit ruby specific in designing the interface. I'd say, go ahead. Kind regards robert