Re: [gnome-db] gda_data_model_update_row syntax



On Fri, 2003-10-17 at 01:43, Paisa Seeluangsawat wrote:
> > I've been thinking that the best thing would be probably to remove the
> > const in all those functions, and clearly specify, in the API
> > documentation, which values CANNOT be freed by the caller. That would
> > remove all this cruft we've got because of those 'const'.
> 
> Could you expound on how this is better than using 'const' to
> distinguish updateable/non-updatable?  I see 'const' not as a cruft,
> but a clean and clear way to tell user that the value is not to be
> changed.
> 
I'm not saying using const is bad, I'm saying the current API uses it
too much, I think, making client applications forced to cast between
const and non-const.

I am not sure how best to fix this, since of course using const is the
best way to specify something is read-only (and, in fact, that's the
reason why we used const so much), but now, with the updatable
recordsets, we might need to remove some of those const. For instance,
in the parameters to some gda_*_ functions. Of course, I'm not talking
about the return values, which should always be const if they are
read-only.

> 
> > So, either we add code to the library to prevent changing the values, or
> > return copies of the values to the caller.
> 
> Returning 'const' in non-updatable row/values is already like shouting
> at the user, "If you update this, bad things will happen."  Isn't that
> enough?
> 
yes. But how do we fix the API to allow both read-only and updatable
objects without having 2 sets of functions? That's what I'm talking
about.

cheers




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