Yes you can set any string in CORBA mode: it is a
string, a real string, not a binary value as is a GUID in COM mode. It should probably not contain spaces, though.
You can abuse a CORBA interface identifier with the string representation of a guid, though....
Querying CORBA style interfaces by its identifier is therefor slower than COM because it involves string comparisons as opposed to COM's QueryInterface. Its only defining feature is that it is never refcounted. You could have known, because it is documented:
https://www.freepascal.org/docs-html/ref/refse50.htmlhttps://www.freepascal.org/docs-html/prog/progsu37.html#x44-430001.2.37Teaser:
program CorbaForDonkeys;
// you can create a Corba class instance through its interface (with as)
// but you can not free it
// you must create Corba classes to a class instance, not the interface.
{$mode objfpc}{$interfaces corba}
type
ICorbaInterface = interface
['ICorbaInterface']
procedure IAm;
end;
TCorbaClass= class(ICorbaInterface)
procedure Iam;
end;
procedure TCorbaClass.Iam;
begin
writeln('I am called through a Corba interface');
end;
var
Intf:ICorbaInterface;
begin
// This is allowed, but you can never free such an instance.
Intf := TCorbaClass.Create as ICorbaInterface; // slow string comparison kicks in
Intf.Iam;
// So how are you are going to free this one?
// Maybe?:
//(Intf as TCorbaClass).Free; // nope, compile time error. This works in COM
// Or:?
TCorbaClass(Intf).Free;// nope, compiles, runtime error. This also works in COM
end.
Now you know why I think Corba style interfaces are very "useful"

And SLOW!! This is particularly noticeable when you need to create many instances.
Better use a non-refcounted COM class, and/or (for non-ref COM
as will work):
// Ok,Ok, can be done, just teasing:
{$mode objfpc}{$interfaces corba}
type
ICorbaInterface = interface
['ICorbaInterface']
procedure IAm;
procedure Free;// ALWAYS add when using CORBA style.
end;
TCorbaClass= class(ICorbaInterface)
procedure Iam;
procedure Free;// introduce this one
end;
procedure TCorbaClass.Iam;
begin
writeln('I am called through a Corba interface');
end;
procedure TCorbaClass.Free;
begin
Destroy;
end;
var
Intf:ICorbaInterface;
begin
Intf := TCorbaClass.Create as ICorbaInterface;// performs slow string comparison
Intf.Iam;
// explicitly add a way to free from a Corba interface instance.
Intf.Free;
end.
Not my taste....
People who think CORBA style interfaces are more lightweight than COM are mistaken, they are merely defective.
This is better and faster:
{$mode objfpc}{$interfaces com}{$inline on}
type
IComInterface = interface
['{A44D1C83-3E1D-4222-AA55-A19F3DD4D8C1}']
procedure IAm;
end;
TComClass= class(TNoRefCountObject,IComInterface)
procedure Iam;
end;
procedure TComClass.Iam;
begin
writeln('I am called through a Com interface');
end;
var
Intf:IComInterface;
begin
Intf := TComClass.Create as IComInterface;
Intf.Iam;
(Intf as TComClass).Free;// because we have no refcount. LightWeight, Still faster than CORBA.
end.