|
@@ -1600,9 +1600,58 @@ function(){
|
|
|
|
|
|
<div class="section">
|
|
<div class="section">
|
|
<h2 id="classinterfaces">Translating class interfaces</h2>
|
|
<h2 id="classinterfaces">Translating class interfaces</h2>
|
|
- Class interfaces are not yet implemented. To make porting code easier there
|
|
|
|
- is a <i>{$modeswitch ignoreinterfaces}</i>, that ignores interface declarations
|
|
|
|
- and the class interface list.
|
|
|
|
|
|
+ JavaScript has nothing like it, so they are emulated.
|
|
|
|
+ <ul>
|
|
|
|
+ <li>methods, properties, default property</li>
|
|
|
|
+ <li><i>{$interfaces com|corba|default}</i><br>
|
|
|
|
+ <ul>
|
|
|
|
+ <li>COM is default, default ancestor is IUnknown (mode delphi: IInterface),
|
|
|
|
+ managed type, i.e. automatically reference counted via _AddRef, _Release, the checks for support call QueryInterface</li>
|
|
|
|
+ <li>CORBA: lightweight, no automatic reference counting,
|
|
|
|
+ no default ancestor, fast support checks.</li>
|
|
|
|
+ </ul>
|
|
|
|
+ </li>
|
|
|
|
+ <li>inheriting</li>
|
|
|
|
+ <li>An interface without a GUID gets one autogenerated from its name and method names.</li>
|
|
|
|
+ <li>a class implementing an interface must not be external</li>
|
|
|
|
+ <li>a ClassType "supports" an interface, if it itself or one of its
|
|
|
|
+ ancestors implements the interface.
|
|
|
|
+ It does not automatically support an ancestor of the interface.</li>
|
|
|
|
+ <li>method resolution, procedure IUnknown._AddRef = IncRef;</li>
|
|
|
|
+ <li>delegation: property Name: interface|class read Field|Getter implements AnInterface;</li>
|
|
|
|
+ <li>is-operator:</li>
|
|
|
|
+ <ul>
|
|
|
|
+ <li>IntfVar is IntfType - types must be releated</li>
|
|
|
|
+ <li>IntfVar is ClassType - types can be unrelated, class must not be external</li>
|
|
|
|
+ <li>ObjVar is IntfType - can be unrelated</li>
|
|
|
|
+ </ul>
|
|
|
|
+ <li>as-operator</li>
|
|
|
|
+ <ul>
|
|
|
|
+ <li>IntfVar as IntfType - types must be releated</li>
|
|
|
|
+ <li>IntfVar as ClassType - types can be unrelated, nil returns nil,
|
|
|
|
+ invalid raises EInvalidCast</li>
|
|
|
|
+ <li>ObjVar as IntfType - mode delphi: types must be related,
|
|
|
|
+ objfpc: can be unrelated, nil if not found, COM: uses _AddRef</li>
|
|
|
|
+ </ul>
|
|
|
|
+ <li>typecast:</li>
|
|
|
|
+ <ul>
|
|
|
|
+ <li>IntfType(IntfVar) - must be related</li>
|
|
|
|
+ <li>ClassType(IntfVar) - can be unrelated, nil if invalid</li>
|
|
|
|
+ <li>IntfType(ObjVar) - mode delphi: must be related,
|
|
|
|
+ objfpc: can be unrelated, nil if not found,
|
|
|
|
+ COM: if ObjVar has delegate uses _AddRef</li>
|
|
|
|
+ <li>TJSObject(intfvar)</li>
|
|
|
|
+ </ul>
|
|
|
|
+ <li>Assign operator:</li>
|
|
|
|
+ <ul>
|
|
|
|
+ <li>IntfVar:=nil</li>
|
|
|
|
+ <li>IntfVar:=IntfVar2 - IntfVar2 must be same type or a descendant</li>
|
|
|
|
+ <li>IntfVar:=ObjVar - nil if unsupported</li>
|
|
|
|
+ <li>jsvalue:=IntfVar</li>
|
|
|
|
+ </ul>
|
|
|
|
+ <li>Assigned(IntfVar)</li>
|
|
|
|
+ <li>RTTI</li>
|
|
|
|
+ </ul>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="section">
|
|
<div class="section">
|