[wx-dev] Ok() and IsOk()
Julian Smart
julian at anthemion.co.uk
Tue Oct 3 23:42:04 PDT 2006
Francesco Montorsi wrote:
> Hi all,
> I found annoying that some wx classes use the Ok() function name
> while others use IsOk()...
>
> I've noticed that basically the classes using Ok() are the GDI objects
> and some stream classes. So I think it should be easy to deprecate the
> Ok() version doing, more or less, the following steps:
>
> 1) s/.Ok(/.IsOk(
> 2) s/->Ok(/->IsOk(
> 3) s/::Ok/::IsOk
> 4) s/bool Ok(/book IsOk(
>
> 5) add to wxGDIObject and wxStreamBase the following functions:
>
> virtual bool IsOk() const = 0;
> wxDEPRECATE( bool Ok() const );
>
> (assuming all wxGDIObject-, wxStreamBase-derived classes do have
> an IsOk() function)
>
> 6) implement the deprecated Ok() function in terms of IsOk()
>
>
> if this approach reveals too simplistic (i.e. too many classes non
> wxGDIObject- or wxStreamBase-derived have Ok()), I think it shouldn't
> be too difficult to write a script which changes in the headers the:
>
> bool Ok() const;
>
> occurrences into:
>
> bool IsOk() const;
> wxDEPRECATE( bool Ok() const );
>
> and in a similar way the sources (adding a dummy impl for deprecated
> Ok())...
>
> is this a crazy idea?
I would welcome consistency, but not the wxDEPRECATE keyword on
functions that are used potentially thousands of time in an application
- there would be huge numbers of warnings for a cosmetic change. In fact
perhaps Ok/IsOK should be made interchangeable in all classes, rather
than deprecating one or the other. It has pretty much zero overhead and
will save thousands of man-hours making an essentially trivial change to
source code - much more annoying and wasteful than the original
inconsistency.
Regards,
Julian
More information about the wx-dev
mailing list