[ZOOM] Re: zoom.hh

Mike Taylor mike at tecc.co.uk
Thu Nov 29 16:27:27 CET 2001


Yesterday I wrote:

> Date: Wed, 28 Nov 2001 17:10:14 GMT
> From: Mike Taylor <mike at tecc.co.uk>
> 
> So we seem to be agreed that in some circumstances, we want records
> to be "owned" by their result sets, so that we don't have to bother
> explicitly freeing them; and in others, we want the records to be
> fully autonomous, so that we can return them from scopes in which
> they are obtained from transient result sets.
> 
> I can think of three, maybe four ways of expressing that choice in
> the interface.  I'll tell you what they are tomorrow, and then we
> can choose which is least offensive.

OK, here are the alternatives I'm aware of:

Option 1 (which is what we have in 1.0g):

	class resultSet {
	  public:
	    const record *getRecord (size_t i) const;
	}

	class record {
	  public:
	    record *clone () const = 0;
	}

Option 2 (which is similar, except that instead of taking an
autonomous copy of an existing resultSet-owned record, an existing
record _becomes_ autonomous):

	class resultSet {
	  public:
	    const record *getRecord (size_t i) const;
	}

	class record {
	  public:
	    void steal(void) const;
	}

Option 3 (in which you can get either kind of record directly from the
resultSet object):

	class resultSet {
	  public:
	    const record *getRSOwnedRecord (size_t i) const;
	    const record *getAutonomousRecord (size_t i) const;
	}

Each of these approaches is of course subject to further refinements
-- for example, the clone() method of the first approach could be
provided in the form of a copy constructor -- but I don't want to talk
about those refinements yet, if we can avoid it: I just want to get a
sense of which of these three fundamentally different models we prefer
for providing both "flavours" of record ownership.

Who likes what?  Why?

 _/|_	 _______________________________________________________________
/o ) \/  Mike Taylor   <mike at miketaylor.org.uk>   www.miketaylor.org.uk
)_v__/\  "Adjectives are like spices, to be used for flavour, with
	 care: not to kill the essential flavour of the sentence" --
	 Rheal Nadeau.




More information about the ZOOM mailing list