Native
Overview
Natives should be considered obsolete. Instead new code should use the Java FFI and .NET FFI features to interop with the JVM and .NET platforms.
We still have a good chunk of original code such as inet
and fwt
which is built using the natives feature. So natives will live for a while longer until we can redesign it using FFI.
Native Peers
TODO
- peer factory
- how subclasses with natives can use single peer (fwt style)
Native Fields
Native fields are similar to abstract fields in that they generate a getter and setter, but no actual storage. The emit process will route the Fan getter/setter to the peer class:
class Native { native Int f } class NativePeer { public static NativePeer make(Native t) { return new NativePeer(); } public Int f(Native t) { return f; } public void f(Native t, Int v) { f = v; } Int f; }
Native fields can be virtual or override a superclass, but cannot be const, static, or abstract.