[fpc-pascal] corba interfaces - is/as not working properly

Michalis Kamburelis michalis.kambi at gmail.com
Fri Sep 30 18:49:45 CEST 2016


2016-09-30 18:19 GMT+02:00 stdreamer <stdreamer at freemail.gr>:
> On 30/09/2016 17:24 μμ, Michalis Kamburelis wrote:
>>
>> 4. And how about going even more further, and just generate an
>> internal GUIDs (random, or based on a memory address) when no GUID is
>> explicitly specified? This way "is", "as", "Supports" always just
>> work. And it removes the need to do 1., 2., 3. above, of course.
>>
>>    Is there a drawback to doing this, that I don't see?
>>
>
> You assume that the interfaces are
> 1) user controlled
> 2) is not used outside from your own environment.
>
> Both valid use cases but invalid assumptions. GUID needs to stay user
> selectable otherwise you loose the ability to implement interfaces for 3rd
> party applications (banking, stock exchange, ms office etc). Interfaces are
> compiler agnostic you might import them to use a 3rd party library (eg. ADO)
> which has its own GUIDs that you must not change.
>

I didn't say I want to remove user-selectable GUIDs from the language.
I understand that e.g. when using COM interfaces for inter-process
communication, you want to explicitly specify the GUIDs.

My point (4.) was to generate an internal GUID *when no GUID is
explicitly specified by the programmer*. This way the interfaces would
work more reliably ("is", "as", "Supports" working as expected) when
you're fine with using them only internally in your application.

Right now, not specifying the GUID of your interface is a trap. You
get something that compiles, without a warning, but "is" and "as"
don't work correctly. See the examples in my email, or in the 1st mail
in this thread. It would be nice to eliminate this trap:)

Michalis



More information about the fpc-pascal mailing list