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

Dana v203
Dana v203 contains bug fixes, new adaptation commands, adaptation permissions and a prototype object halt operation.

New adaptation commands and permissions

We've been thinking about the way adaptation works (as ever!) and particularly on the limitations of our current adaptation protocol operators. In designing a programming language we try to provide a generalised basis on which to build whatever the programmer might like, and our set of adaptation operators didn't quite match up to this. Here's what's new:

- dana.getObjectID(): this operator replaces both dana.notifyActive and dana.notifyInactive, which in previous versions of Dana caused functions on the AdaptEvents interface to be called. The new operator getObjectID() allows the programmer to query an object for any secondary interface, and then call functions on that interface in a generalised way.

- dana.getComponent(): this operator retrieves the IDC of the component to which a given required interface is currently connected, if any, and fits together with our new adaptation permission approach.

- dana.adaptConstructFree(): this operator constructs an object with a fresh, brand new instance of transfer state from the object's primary interface. This allows a larger palette of adaptation types, and is particularly useful for adding interception components that don't disturb the transfer state of the component being intercepted.

- adaptation destructors: in previous versions of Dana, the AdaptEvents interface was also used to received notifcations of what an object was being destroyed as a consequence of having been adapted away from. We have now moved the adaptation destructor to its own interface, AdaptDestructor, which helps to avoid confusion when implementing AdaptEvents but not wanting to offer an alternative destructor.

- permissions: in previous versions of Dana we've conceptually allowed any component to use any adaptation commands in any context. We've now updated a key set of adaptation so that they effectively enforce a permission system, because they require the programmer to pass in a reference to the component from which an object under adaptation is currently sourced. This essentially means that adaptation is only driveable by program elements that loaded the component(s) being adapted.

Object halt

This is a first step of something we're looking at across the language: how to deal with misbehaving components. In many ways Dana components are "micro-services" that represent a contained scope of functionality analogous to a "process". This suggests that there should be a way to forcibly stop and remove misbehaving components from the system, an idea that object halting is one step towards.

We've introduced a new system operation dana.halt(), to which you you can pass an object reference. Dana will then stop all computation that is resident in the object, including any computation which flows through the object via function calls that have passed through it and potentially continued beyond it, blocking until all such computation has been shut down. Any functions that called into the object being halted will resume immediately after the call, behaving as if the function that they called on the object has aborted with an exception, returning its default value. As with our above permissions approach, dana.halt also requires that you pass in a reference to the component from which the object is currently sourced, therefore only allowing these operations for entities that loaded the component in the first place.

We should note that dana.halt is currently experimental in nature, as it does not yet work in all cases. Specifically, it will potentially block forever if computation active or flowing through the halting object is currently blocked inside a native library call, which is currently beyond Dana's ability to interrupt and cancel. Even so we think this represents a useful functionality that we'll continue to build on and generalise in future.

That’s all for now – happy coding :-)
by barry on 2017-05-13 17:58:38 (0 replies)

© Francis Research Ltd. 2018