- dispatch-uri URIprocedure
The main interface to dispatch-uri. This procedure invokes the dispatch-mechanism with the supplied uri. The dispatch-algorithm is implemented as follows:
(Note See also the whitelisting-section, to learn how to limit the exposure of procdures)
- The path is empty. It checks if default-dispatch-target is bound to a procedure. If it is, then it is invoked. If it is not, then dispatch-error is invoked.
- The path has exactly one element. It assumes that this element is the name of a thunk that was defined outside a module. If such a thunk exists it is invoked. If no such a thunk exists dispatch-error.is invoked.
- The path contains at least two elements.
- It checks if the second element is a procedure defined in a module named by the first element. So if it sees (foo bar) it tries to find the procedure bar inside the module foo. If the procedure exists it is invoked with the rest of the elements as arguments.
- If it does not exist, it interpretes the first element as the name of a procedure that was defined outside any module. If such a procedure exists, it is invoked passing the rest of the elements as arguments. If no such procedure exists dispatch-error is invoked with the full path as arguments. The path is applied to the procedure so you can use for example dsssl-style lambda-lists to declare optional arguments or a rest-argument.
All those lookups are done in the current dispatch-environment, which can be parameterized.