Hacker News new | ask | show | jobs
by graemeg 43 days ago
It's magic! ;-)

Not wanting to go into too much technical details: Blaise's interface system uses TypeInfo pointers as identity tokens. Meaning manually added GUIDs are not needed.

The two Supports() forms. Delphi has two overloads:

// 1. Boolean test function Supports(AObject: TObject; const IID: TGUID): Boolean;

// 2. Combined test + assignment (the useful one) function Supports(AObject: TObject; const IID: TGUID; out Intf): Boolean;

In Blaise, without GUIDs, the second argument is an interface type identifier rather than a GUID. The most natural design is to treat Supports as a compiler intrinsic (like is/as) rather than a library function, because the second argument isn't a runtime value — it names a type.

So Blaise code looks like this:

if Supports(Obj, IFoo) then ... // boolean test if Supports(Obj, IFoo, FooRef) then ... // test + assign fat pointer

1 comments

Ok, so not unlike the RTTI helpers in Delphi then.

Consuming a precompiled binary like a third-party DLL is out of scope then presumably, since TypeInfo pointers won't match.

Which is fair enough, it's not that common these days beyond actual COM usage.

But still not sure exactly why no GUID is a selling point. It's just a bit of metadata.