Rony G. Flatscher wrote:

In principle we have the necessary mechanisms in Basic and PyUNO (see previous post by Jörg). However, since the existing mechanims are "heavy" and ugly, they are not used consistently in practice. That means that much of the code that is written in those language bindings is fragile. Rony is right in that another approach to the design of those language bindings might have made it easier for users to create robust code.


The only option to solve this 'unfragile' is to introduce a mandatory queryInterface() call however it might look like.

But I think the most striking advantage a typeunsafe over a typesafe language has, is that you need to write less source code to do the same thing. If the language binding would be designed with an queryInterface, the advantage would vanish hurting you with nearly every line of uno code you write, so I would implement it again this way.


This depends very much how the queryInterface is implemented: whether the programmer needs to explicitly carry it out, or whether the runtime support could do that "under the covers".

E.g., in the ooRexx support for UNO/OOo the connection-routine looks like:

------------- cut here -------------
::routine UNO.connect public
 parse arg unoURL     -- retrieve the argument, if any

xContext=.UNO~Bootstrap~bootstrap -- get an initialized local UNO runtime environment

 if unoURL="" then  -- no unoURL given, use default (local installation)
return xContext -- return the context object (which can be used to get the service manager)

-- use the received unoURL to establish a connection to the remote object uur= xContext~getServiceManager~createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", xContext) remoteObject = uur~XUnoUrlResolver ~resolve(unoURL) -- get the connection
 return remoteObject

------------- cut here -------------

Looking at the code (the tilde is the message operator, i.e. left of it is the receiving object, right of it the name of the message), there is no queryInterface() at all. However, wherever the name of an interface is used as a message name (like at the end of the code snippet, the message "XUnoUrlResolver"), the "under the covers" support will carry out the queryInterface().

Just curious: how do you write down in ooRexx calls to method bar on an object that implements the two interfaces

  module m1 { interface XFoo { void bar(); }; };
  module m2 { interface XFoo { void baz(); }; };

-Stephan

[...]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to