Re: Stream::read



Hi Miguel,

On 28 Jun 2000, Miguel de Icaza wrote:
> >       I'm begginning to get annoyed with:
> [...]
> >               long read     (in long count, out iobuf buffer)
> >                       raises (NoPermission);
> >
> >       The iobuf buffer has a _length field, so why do we duplicate this
> > information in the 'long' return value ? it is annoying to have to check
> > the exception then take the min of retval + buffer->_length.
>
> The `count' expresses how many bytes to read.  the buffer._lenght
> indicates how many bytes were read.  For instance, you could request
> 10 bytes, but only get 1 back.
> And you do not want to make `buffer' an inout.

	Normaly it is a safe assumption to assume I am talking
rubbish; but please read the drivel to check, sometimed I might say
something co-herent. I must confess though that someone else misunderstood
the above paragraph in a different way, so I will perhaps re-write it with
capitilization to aid comprehension:

	LONG read (in long count, out iobuf buffer)

	The iobuf has a _length field, so why do we duplicate this
information in the LONG return value ? it is annoying to have to check the
exception then take the min of retval + buffer->_length.

	And if that is not clear enough; how about this code fragment:

		CORBA_long len;

		/* 128 == a sensible size ? */
		len = Bonobo_Stream_read (stream, 128,
					  &buffer, ev);

		/*
		 * Will this ever fail ? [ No ].
		 */
		g_assert (len == buffer->_length);

	The objection you are about to make 'A -1 value in len indicates
an exception' is total specious since you will have to check ev->_major
anyway so you end up duplicating stuff and creating confusion, clutter and
inefficiency.

	I hope the question is more clear now; the answer is trival simply
say 'Yes' and I'll fix it, removing the redundant return value.

	Regards,

		Michael.

-- 
 mmeeks@gnu.org  <><, Pseudo Engineer, itinerant idiot





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