This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: blocks/views and wrappers


Gerard Jungman wrote:

> Exposing different types would be wrong,
> since the end user rarely cares about the distinction,

No.
The application programmer must keep track
of which views do and don't own data blocks
so that they can free the view and the data block that it owns
before the thread of execution passes out of the scope
of the pointer to the view.

> and certainly would not want to deal with
> the proliferation of interfaces that this could entail.

There is no "proliferation of interfaces"
in an object oriented programming language like C++
which supports inheritance.  The point is that
because the ANSI C programming language does not support inheritance,
the same type must be used for both views that own their data block
and views that don't own their data block.
And application programmers are obliged to keep track of which is which.
The GSL library can't help except possibly to detect
when the application programmer attempts to apply, for example,
function gsl_vector_free to a vector view that does not own
the data block associated with it.

> >         typedef gsl_vector gsl_subvector;
> 
> This seems harmless.
> It might confuse more people than it helped.

You should expect application programmers to ignore this synonym
if they find it confusing.  Anyway,
application programmers will probably invent their own synonyms
and use them instead of the type names provided by the GSL.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]