[Bf-python] Making IK flag writable in the Bone class
Stephen Swaney
sswaney at swbell.net
Fri Oct 22 20:56:30 CEST 2004
Jonas Petersen wrote:
>
> Stephen Swaney schrieb:
> >
> > From an API point of view, I really, REALLY dislike the idea
> >of overloading a query function to set and unset a flag.
> >
> >
> >
> Me too :)
>
> But it's done like this in other places as well. So I thought it would
> be ok. Check out NMesh for example. It has 3 "has*" functions, which all
> have an optional parameter to set the flag.
That doesn't make it any less weird or confusing. IMHO, stuff like
this should be flagged in the 0-todo.txt file for cleanup and
deprecation.
We should either follow a get/set function pair style or use
a C++ overloaded method style.
Boolean someFlag(); // gets value
None someFlag( param ); // set value
Having a function called hasSomething() that also sets the value
is misleading. It is also unclear. Without looking at the code,
is the return value the flag state from before or after the flag
is set?
--
Stephen Swaney
sswaney at swbell.net
More information about the Bf-python
mailing list