From: Hakki D. <dog...@tr...> - 2006-05-19 16:40:13
|
Hi, 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... > >> 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. > > >> 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. > > Francesco > > 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? -- Regards, Hakki Dogusan |