Re: gparamspecs.c param_double_validate() doesn't support NaN/Inf?



On Sat, 10 Jan 2009 13:42:31 +0200 Andrew W. Nosenko wrote:
 
> First at all, could you provide any real-world example, where min/max
> restriction on GParamSpec could be usefull?  The reason is simple:
> when validation fails, the application has no way to know about it
> and, therefore, to do anything usefull.  There just no interface for
> such things, like "validation-fails-callback".  As consequence, any
> validation should be done at the application level, before bringing
> GObject/GParamSpec/GValue/etc machinery into game.  Hence, I hard to
> imagine any usefull example of using restrcted GParamSpecs...

Then you really just aren't imagining hard enough.  If you look at the
gdk/gtk sources, there are quite a few GObject properties that use
GParamSpecDouble that restricts the min/max value a property can have.
For example, think of a progress bar that uses a double to indicate
the percent full: 0.0 is 0%, 1.0 is 100%.  Any value outside that
range is invalid.

But I don't disagree that NaN or +/- inf should be allowed, assuming
a restriction such as the above isn't in place for the particular
instance of GParamSpecDouble.

	-brian


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