Lyle Johnson wrote:
Joel VanderWerf wrote:
One question: sometimes an accessor has a set* method associated with
it (e.g. FXWindow#height= and #setHeight), but the set method is not
listed in the docs. That’s good because it simplifies the docs and
encourages use of the more ruby-like style. But occasionally I like to
override the writer method, and reserve the set method for internal use.
I’m not sure I follow; are you talking about setXXX() methods that are
defined as virtual functions in the C++ library (and are therefore
useful for overloading)? Could you maybe spell it out more slowly for me
?
Sorry… writing too much code and not enough English lately…
I’ve been using irb to look for methods, like this:
irb(main):003:0> FXWindow.instance_methods(1).grep /height/i
[“getDefaultHeight”, “getWidthForHeight”, “getHeightForWidth”,
“defaultHeight”,
“setHeight”, “height=”, “getHeight”, “height”]
But I don’t see “setHeight” in the new documents, just a height
attribute, which is RW.
I’m not sure if I can always assume that any attribute with a writer
#foo= also has a corresponding #setFoo. (They are semantically the same,
right?)
No change is needed, since there’s always irb. As you have it, the docs
are shorter, and encourage reader/writer methods instead of get/set
methods, which are more readable anyway.
It would be nice, though, if there was a way to change the line
:height [RW]
to
:height [RW] also has setHeight, getHeight
Or can we always assume that they exist if the reader/writer does?