On 5/19/06, Hakki Dogusan <[EMAIL PROTECTED]> wrote:
Francesco Montorsi yazmış: > John Labenski ha scritto: >> In going through the the interface files I've noticed that there are a >> few naming inconsistencies for C++ overloaded functions and >> constructors. Typically they have the names that wxPython uses (where >> noted in the docs) and for the most part are fine, but... >> >> Since we can overloaded function in wxLua directly (usually) we don't >> actually need to give them unique names, however they need some sort >> of name for the C function and might as well be accessible in wxLua >> using that name as well as the overloaded way. > however I'm not sure that having two possible names (e.g. InsertItem and > InsertItemString) for the same functions (in lua scripts) is a good > thing: it probably means there will be scripts with a messy mix of the > two...
This is true, hopefully people will just use the overloaded methods as shown in the samples (todo). There's still some work to be done with the overloaded functions, like static functions don't work, but I don't forsee anything that should make it impossible.
>> Suggested rules for renaming: >> 1) Most "commonly used" or default function gets actual name >> 2) Function names use the original name + [With][Data type] >> ex. Append(int n), Append(wxString s) -> AppendString(s) >> ex. Append(int n), Append(int n, Stuff s) -> AppendWithStuff(n, s) >> 3) Class constructors start with the ClassName + From[Data type] >> Default constructors are always wxClassNameDefault() >> Copy constructors are always wxClassNameCopy(const wxClassName& c) >> >> Obviously there will be exceptions or cases where the name may sound >> awkward, but the number of these will be small. > I agree: better follow a unique rational rule. This will reduce the > number of times the user is forced to look in the manual to find the > right name of a function.
Good, I'm glad you agree. Again, for the most part they follow the above "rules", but there's some oddballs.
>> Hopefully you can see that the naming right now can be fairly >> arbitrary, where the default wxImage constructor makes a copy? >> wxEmptyImage? wxDefaultImage? The default for wxBitmap takes the >> bitmap data itself, but only for MSW, how useful is that? >> >> I would like to normalize all of these, obviously breaking >> compatibility, but better sooner than later. :) There's probably about >> 2 dozen of them to change. > I agree that this should be done as soon as possible.
Next week, I'm off for the weekend.
I was naming my python bindings (with swig) like wxPython. But for lua I'm not duplicating functions for every different params; I'm checking them in wrapping functions. I'm using luna. So all wrapping is hand made :) Ex: in C++ : Send(int), Send(wxString), Send(int, int),... becomes in Lua: Send(...) But I don't know how something like that can be generated automatically. Does toLua handle overloaded functions?
Dunno, wxLua uses it's own wrapping mechanism for better or worse. Probably for the better since we have control over it and there's a few thing in wxWidgets that we have to handle specially, like wxWindow derived classes. http://wxlua.sourceforge.net/docs/binding.html http://wxlua.sourceforge.net/docs/wxluaref.html Regards, John Labenski Rȧ:&q«[ºÙŞyÛhv¨ã^yÛh²êi¢»py»®øzËrêâ·!¶Ën}÷hê®É%ËŞ{^¶yÛ^rè2¶ì¨º¸èmæ¬êã å¡§HÅm*az·¦bq«b¢t®÷«¿]5m«vÀ¥§!xg«¢x¦¢m§ÿìzV¬ºÇÚF ë±é\
