next up previous index
Next: Dynamic Procedures Up: Module System Previous: Other Modular Items   Index


Privacy

In an incremental Prolog system like ECLiPSe the privacy requirement can sometimes be obstructive with regard to program development. The internals of modules which are developed incrementally should be accessible from outside, e.g. for debugging purposes. Therefore, the module system of ECLiPSe provides therefore a way of switching on the privacy of a module, called locking a module. Once an application or a part of it is stable, the respective modules will be locked and gain complete privacy.

Once a module has been locked (with lock/1,2), it is not possible to access the information contained in it from the outside of the locked module. Its contents is hidden to the outside. However, it can be normally used through its interface. Only modular items which are global or exported can be accessed.

Moreover, if a tool (no matter whether it belongs to a locked module or not) is not called through its interface, it will not be possible to execute any predicate in the module space of the module passed as argument if that module is locked (an error will be raised in this case). This is necessary to prevent calling a tool body with a locked module M as argument from another module than the module M itself, otherwise privacy would not be respected. However, when the tool is called through its interface, the system certifies the ``authenticity'' of the module argument and the tool body will be able to use the module argument safely.

Note also that predicates like listing/0 work only on the predicates defined in the caller module (not on the visible ones). It means that the tool body of listing/0 must be called to list procedure defined in other modules. If that module is locked, the access will be refused. Therefore, the only way to list procedures defined in a locked module is to call the listing predicate (through its interface procedure) from that module.

ECLiPSe provides two locking mechanisms: one which is not reversible (lock/1), the other one which allows the module to be unlocked providing a given key (lock/2 and unlock/2).


next up previous index
Next: Dynamic Procedures Up: Module System Previous: Other Modular Items   Index

1999-08-06