[ Prev ] [ Index ] [ Next ]

Fallback Slot

Created Tuesday 18 November 2008

Status

A prototype was made, it didn't worked very well, but the basic functionality was there.

Abstract

This specification aims at describing fallback slots. It would be a generic slot called only on the prototypes that allow it when a message is sent to an object that doesn't implement the corresponding slot (or in some other cases).

This introduce some king of introspection. This idea was primarily intended to allow a binding of the dBus library that translate local messages (slot calls) to messages sent over a network (generally using unix sockets). dBus is primarily used as an mean of communication between processes and is increasingly used on free desktops. Some application includes:

It is becoming an increasingly important part of modern operating system (GNU/Linux and other unices). Its usage is necessary to access some important part of the OS API. This is why we need a binding (or an implementation) in Lisaac.

Because dBus translates local messages to send them to the network, and because these messages (the slot name) heavily depends upon the remote service called, we can't have the slot names fixed at compile time (or it would require to create a different wrapper for every dBus server under the sun).

The solution presented here transform static calls to unknown messages (only on specific types) to calls to the fallback slot, which in case of dBus will serialise the message according to the dBus format and send it.

Syntax

We introduce a new variable in the Section Header:

 Section Header
 
   + name := PROTOTYPE;
 
   - fallback := All|Unknown|Foreign|AllForeign|None;

Four values are possible for the fallback header slot:

The fallback status is not inherited

All and AllForeign might be useful to trap every message sent to an object, and forward it for example to a plugin, or another program. Foreign might be useful to trap messages sent from another objects. For example it could be used to implement COP where the message is put in a queue.

The fallback slot

When a message is catched and forwarded, a specific slot (the fallback slot) will be called instead. This message will receive:

And it will return:

Because the types of the arguments are not known at compile time, they will all need to inherit from OBJECT. Expanded types will need to be packed in a specific generic type before. The return values will also be returned as OBJECTs. If the number or the type of the returned values is not what expected the caller, the default values of what expected the caller will be returned instead.

Other possible uses

Communicate with:


Backlinks: :Computer:Lisaac:Specs