This page is divided into three sections, first the vision for what this interface aspires to converge to, then the current Michigan implementation, then the current Berkeley implementation.
Aspiration
Reasonably Agreed Upon
<T> get(<string> port_name)
: Get the value of an input to a given port.
<void> send(<string> port_name, <T> val)
: Send a value to an output port.
<string> get_parameter(<string> parameter_name, [<T> default])
: Get the value of a configured parameter that was passed to accessor when it was created. An optional second argument provides a default value for a parameter. Parameters allow for configuring generic accessors to specific instances of devices. Parameters are distinct from inputs in that they are guaranteed to be immutable.
Less set in stone
Though I (currently) think they're right :) -Pat
These tie somewhat into the Michigan ontological structure, in particular the concept of well-specified interfaces---collections of ports---and ports as strongly-type interfaces.
<void> provide_interface(<string> path)
: Specify that this accessor implements a particular interface. By providing an interface, an accessor is required to implement all of the ports specified by the interface. In practice, this means defining a function for each interface. The function name is exactly the interface and port name, e.g. to provide the lighting.Color port, authors must define a global lighting.Color = function (<string> color) { ... }
.
<void> create_port(<string> direction, <string> name, <object> options)
: Create a one-off port for this accessor.
<accessor> load_dependency(<string> path, <object> parameters=null)
: Loads a new accessor as a dependency. Dependencies are guaranteed to exist at runtime.
Current Michigan Implementation
See https://github.com/lab11/accessors/tree/master/runtimes#accessor-framework-functions .
Path to aspiration (TODOs)
- Think through our notion of a cached
get
and when that does and doesn't make sense more generally.
set
to send
- Add missing default parameter to
get_parameter
.
- Remove the mapping dict from
provide_interface
. It's easier to comprehend an accessor if a port function is named exactly after the interface it implements.
Current Berkeley Implementation
See Top-Level JavaScript Functions
Path to aspiration (TODOs)
Michigan would like to move many of the Berkeley top-level functions to modules:
Back to accessor specification