QtScript

Simon Hausmann hausmann at kde.org
Tue Feb 6 10:09:09 GMT 2007


On Tuesday 06 February 2007 10:09:05 David Faure wrote:
> On Tuesday 06 February 2007, Simon Hausmann wrote:
> > instead of duplicating your entire existing API, which is
> > what you have to do with kross. Just look at kword's scripting plugin to
> > see what I mean.
>
> Actually this might be a good example of the opposite. Having scripting API
> very close to the C++ code is what we had with the DCOP interfaces in
> koffice-1.x, and it was so close to the code that there is _no_ way to
> provide the same interfaces after a rewrite of the core like it is
> happening for koffice-2.x. All the internal notions (the need to create a
> KWTextFrameSetEdit before inserting text, etc.) are exposed to the
> scripting API; which kills any possibility of refactoring later. Instead,
> we want to define clean scripting APIs that are independent from the
> application design. That looks like duplication but it's IMHO the only way
> to ensure stability of the scripting API.

I agree about not exposing the lowest internals to scripts, but on the other 
hand you have to admit that it's silly to duplicate easy APIs. For example if 
you have a pageCount property and a pageCountChanged() signal in your 
document it's ugly to add it twice and write code to relay it.

That is why I like a hybrid approach with adaptors, just like in the dbus 
bindings. Re-use as much as possible but make it easy to keep interfaces for 
compatibility (change your main interface? -> add an adaptor for the old 
interface) or override individual aspects.

Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070206/45185f29/attachment.sig>


More information about the kde-core-devel mailing list