|
|||
| << | >> |
|
Comments. Here's an overview of my idea. The Freeform class is really just for encapsulation
purposes; it should probably be a module unless it changes to have its own instance variables and
so on.
Freeform itself simply unifies three other APIs into one. The primary API is that of the editor (shown by a box that is central and larger than the other two). This is a Ruby-like API that sits on top of the Scintilla wrapper (generated from the scintilla.iface file). This seems like "wrapping a wrapper," of course, but it's a justifiable endeavor. The Scintilla API is very non-OO despite being implemented in C++, and the Ruby wrapper naturally has a one-to-one mapping with the original. It seemed best to me to leave the original wrapper "as is" (especially since it is generated) and create another layer of abstraction. (As someone said, "Computer science is the discipline that believes all problems can be solved with an additional layer of indirection.") Of course, if speed ever became an issue, the Ruby-like API could be implemented as an extension directly in terms of the C++ functions. Long before that happens, the API will change. The two lesser parts of Freeform are the Parser API and the GUI API. The former is just a convenient interface giving direct access to the parsed Ruby source. The latter is just a set of routines making it simple to communicate with the user (since many refactorings will require user confirmation or interaction of various kinds). |