Home Demos Forum Research Guide
Viewing topic in forum 'announcements'
back to topic list

Dana v167
Dana v167 provides bug fixes, a slightly revised runtime adaptation protocol, and a new system interface to provide information about the runtime.

Runtime adaptation

In Dana v163 we introduced a major revision to the runtime adaptation protocol, providing a modular procedure that was optimal for both stateless and stateful objects.
Since then we've introduced another element of the protocol to further optimise stateful objects. This is the AdaptEvents interface, which has three functions:

interface AdaptEvents{
    void active()
    void inactive()
    void destroy()

The active and inactive functions are the most important part of the protocol update. A component can provide the AdaptEvents interface as a secondary interface on a given object implementation, and the above functions will be called during the adaptation protocol.

The inactive function is called just before the existing object is rewired out of the system. This allows it to "commit" any internal state into the transfer state of its interface. This is useful for objects that maintain complex internal state but have a simpler version of that state in the transfer fields of the interface. Maintaining the simpler version of state constamtly would be costly, and so this feature provides a way to avoid that constant maintenance.

The active function is called just after the new object has been rewired into the system. This provides a notification that the object is now the "active" one, and it can perform any actions relevant to that status.

Finally, the destroy function is called when a previously used object is being destroyed following an adaptation. Again, this is sometimes useful to perform specialised cleanup actions that are relevant to have been adapted out of the system.

System interface

We've also added another new interface called System, provided by the runtime. If a component declares a required interface of this type, it will be automatically bound to the runtime's implementation of this interface.

interface System {
    byte[] getVMType()
    byte[] getHostType()
    String[] getSearchPaths()
    String[] getAutoBindings()

This provides useful information about the Dana runtime, including the search paths that it is configured with, and the set of interfaces that the runtime itself provides.

Besides these changes we've also added a collection of smaller compiler enhancements and general stability improvements, and we've finished updating all standard library components to take full advantage of the new runtime adaptation protocol.

Happy coding :-)
by barry on 2016-04-15 08:22:10 (0 replies)

© Francis Research Ltd. 2017