[ wxwindows-Patches-1877188 ] wxColour::GetAsString -> ToString

SourceForge.net noreply at sourceforge.net
Mon Feb 4 01:29:46 PST 2008


Patches item #1877188, was opened at 2008-01-22 12:36
Message generated for change (Comment added) made by vadz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1877188&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Common
Group: None
Status: Closed
Resolution: Rejected
Priority: 5
Private: No
Submitted By: troelsk (troelsk)
Assigned to: Nobody/Anonymous (nobody)
Summary: wxColour::GetAsString -> ToString

Initial Comment:

The name "ToString" is used elsewhere in wx, while "GetAsString" is not. The name ToString is (closer to) 'universally' acknowledged I believe.

Patch:
- Renaming "GetAsString" to "ToString", for consistency. 

Notes:
- Maybe it's time to deprecate wxToString(wxColourBase/wxFontBase) and wxFromString?


----------------------------------------------------------------------

>Comment By: Vadim Zeitlin (vadz)
Date: 2008-02-04 10:29

Message:
Logged In: YES 
user_id=71618
Originator: NO

Yes, they're not templates, sorry, we don't provide any generic
implementation (but we should -- using std::stringstream -- when we can).
It doesn't change the intention of the code however and I think you are
just completely missing it if you think the calls to them can be replaced
with T.ToString(). Hint: we want to be able to store any types in wxConfig,
including user-defined ones and even those that the user doesn't have any
control over (such as classes of another library).

Besides, I know that you know that I told you this many times in the past
but it's *really* inconvenient to post replies here. If you'd like to
discuss this further or have any questions, please post to wx-dev. If not,
I'm sorry, but I'm not going to continue to answer them here, this
interface is not made for email exchanges and I'm not masochistic enough to
use it for them.

----------------------------------------------------------------------

Comment By: troelsk (troelsk)
Date: 2008-02-04 10:14

Message:
Logged In: YES 
user_id=1290727
Originator: YES


>You're missing the fact that wxTo/FromString() are template functions

No and no. (Not missing anything today. wxTo/From are not 'template
functions')

Choosing wxToString(T) over T.ToString() is obviously "misguided"
(wxConfigBase).



----------------------------------------------------------------------

Comment By: Vadim Zeitlin (vadz)
Date: 2008-02-03 21:29

Message:
Logged In: YES 
user_id=71618
Originator: NO

1. Consistency is good and should be taken into account when adding new
functions. However it hardly justifies deprecating, let alone removing, the
existing ones.

2. You're missing the fact that wxTo/FromString() are template functions.
They're there to allow converting arbitrary objects to strings (without
using std::stringstream)

----------------------------------------------------------------------

Comment By: troelsk (troelsk)
Date: 2008-02-03 16:31

Message:
Logged In: YES 
user_id=1290727
Originator: YES


1. Right. Three names for functions doing the same one thing
- GetAsString (wxColour)
- MakeString (wxVariant)
- [wx]ToString
(wxLongLong+wxAcceleratorEntry+wxColourData+wxNativeEncodingInfo+wxNativeFontInfo+xti)

ToString seems to be most popular by far.

2. This being a C++ class framework, why establish (yet more) non-class
global functions when member funtions will do just as well?!
(Non-class global functions as such are fine, but perhaps better not
overdo it)

>In general, I think it would be much productive to discuss your
ideas...on wx-dev

Yes yes, I know.


----------------------------------------------------------------------

Comment By: Vadim Zeitlin (vadz)
Date: 2008-02-03 14:55

Message:
Logged In: YES 
user_id=71618
Originator: NO

I agree with Marcin on all counts:

1. GetAsString() is different because it has an extra parameter describing
how it works. Besides I really don't think it's a good idea to go
change/rename existing functions without a really good reason to do it so
while I could understand  adding ToString() to wxColour, I definitely
disagree with renaming GetAsString().

2. There is no reason whatsoever to deprecate wxTo/FromString(), why on
earth do you want to do this?

In general, I think it would be much productive to discuss your ideas
about possible wx improvements on wx-dev first instead of producing patches
without consulting with anybody, it's a much less efficient way of working.
Thanks!

----------------------------------------------------------------------

Comment By: Marcin Wojdyr (wojdyr)
Date: 2008-01-23 14:10

Message:
Logged In: YES 
user_id=586843
Originator: NO

- docs are not changed in this patch
- color->string function is a bit different than other ToString(), it
takes an argument.

> - Maybe it's time to deprecate wxToString(wxColourBase/wxFontBase) and
> wxFromString?

I don't think so, they functions were introduced recently. 



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1877188&group_id=9863




More information about the wx-dev mailing list