diff options
| author | 2025-02-27 17:22:01 -0500 | |
|---|---|---|
| committer | 2025-02-27 17:22:01 -0500 | |
| commit | e1c14b20b372ebbcba1b7d199e3eb2f0445ba1f1 (patch) | |
| tree | 8eabd367957364877e62fbea160eec895b94045f | |
| parent | replace comment about single dispatch and inheritance in README (diff) | |
remove special handling of the default implementation
| -rw-r--r-- | README.md | 23 |
1 files changed, 8 insertions, 15 deletions
@@ -127,13 +127,17 @@ dispatch on (in order of precedence): * local scope * dynamic scope * global scope -* the default implementation. +* default implementation in local scope +* default implementation in dynamic scope +* default implementation in global scope + +The scope resolution tries to find the most specific implementation, and +given a specific implementation, the closest scope. The SAHP will raise an error object that satisfies the predicate `SAHP-implementation-not-found-error?` if no implementation is found. -Multiple SAHPs can share global scope tables, dynamic scope, and default -implementations. +Multiple SAHPs can share global scope tables, and dynamic scope. The procedures stored in a SAHP must take at least one argument, which is the argument whose type is dispatched against. @@ -152,6 +156,7 @@ A type expression is defined as: `all-real`, `all-complex`, and `all-number`, or * Lists of type expressions, or * the value bound to a name of a record type, or +* the symbol `*`, for the default implementation * any other implementation defined value. ### The Object @@ -177,18 +182,6 @@ Set `SAHP` to resolve to `procedure` given `type-expr` in global scope. Creates a procedure with the given arguments and body. The SAHP will resolve to this procedure given `type-expr` in global scope. -### The Default Implementation - - (set-default-SAHP! SAHP procedure) - -Set `SAHP` to call `procedure`, if called with a type `T` that the SAHP -does not resolve to any procedure in any scope. - - (define-default-SAHP (name arguments . arg-rest) body ...) - -Creates a procedure with the given arguments and body. The SAHP will -use it as the default implementation. - ### Dynamic Scope (parameterize-SAHP ((SAHP (type-expr value) ...) ...) body ...) |
