Re: #50218 - Notification on write-only properties is questionable/problematic



Tim Janik <timj gtk org> writes:

> On 28 Mar 2001, Owen Taylor wrote:
> 
> > 
> > Tim Janik <timj gtk org> writes:
> > 
> > > On 26 Mar 2001, Owen Taylor wrote:
> > > 
> > > > I think you were in agreement that notification on write-only properties
> > > > was a bad idea. 
> > > > 
> > > > What was the concrete step to take here - something like the following
> > > > patch?
> > > > 
> > > > Regards,
> > > >                                         Owen
> > > > 
> > > 
> > > > -      NotifyQueue *nqueue = object_freeze_notifies (object);
> > > > +      NotifyQueue *nqueue;
> > > > +
> > > > +      g_return_if_fail (pspec->flags & G_PARAM_READABLE != 0);
> > > > +
> > > > +      nqueue = object_freeze_notifies (object);
> > > 
> > > dude, you're cruel! ;)
> > > shouldn't we just silently ignore this?
> > 
> > Hmmm, if g_object_notify (SOME_WRITEONLY_PROPERTY) does nothing,
> > then its a bug to call it, and we should warn, right? 
> > 
> > Otherwise, some poor programmer is going to be trying to figure out
> > why they aren't getting notified of the changes that they are
> > notifying.
> > 
> > > also this would still queue changes for g_obejct_set(), so i'll add the
> > > check to object_queue_property():
> > 
> > OK, silently ignoring it there is needed, but it still seems to
> > me that we should warn when someone tries to do it explicitely.
> 
> hum, i'm not so sure g_object_notify (SOME_WRITEONLY_PROPERTY) should
> be considered a bug. if we silently ignore it, readability of a property
> can be easily changed during development phase without having to get rid
> of all notify calls currently there (and worse, adding them back if you
> later decide !readable wasn't such a good idea).

I don't think that indecision about whether a property is going
to be write-only or not is going to be that common....
write-only properties are pretty rare to begin with.

Silently ignoring invalid calls is not something we typically
do, and if I changed a property to be write-only, I think I'd
prefer to be warned if I was still notifying it.

Regards,
                                        Owen




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