|
6904 | 6904 | (dissoc! m k)))
|
6905 | 6905 | (transient (.- self -proxy-mappings)))
|
6906 | 6906 | (persistent!))]
|
6907 |
| - (set! (.- self -proxy-mappings) updated-mappings) |
| 6907 | + (. self (_set_proxy_mappings updated-mappings)) |
6908 | 6908 | nil))
|
6909 | 6909 | "_proxy_mappings" nil}
|
6910 | 6910 |
|
|
6996 | 6996 | (. proxy (_update-proxy-mappings mappings))
|
6997 | 6997 | proxy)))
|
6998 | 6998 |
|
6999 |
| -;; TODO: kwargs on supertypes |
7000 | 6999 | ;; TODO: check interface/superclass method membership
|
7001 | 7000 | (defmacro proxy
|
7002 | 7001 | "Create a new proxy class instance.
|
|
7025 | 7024 | ([arg1] ...)
|
7026 | 7025 | ([arg1 & others] ...))
|
7027 | 7026 |
|
| 7027 | + .. note:: |
| 7028 | + |
| 7029 | + Proxy override methods can be defined with Python keyword argument support since |
| 7030 | + they are just standard Basilisp functions. See :ref:`basilisp_functions_with_kwargs` |
| 7031 | + for more information. |
| 7032 | + |
7028 | 7033 | .. warning::
|
7029 | 7034 |
|
7030 | 7035 | The ``proxy`` macro does not verify that the provided override implementations
|
7031 | 7036 | arities match those of the method being overridden."
|
7032 | 7037 | [class-and-interfaces args & fs]
|
7033 | 7038 | (let [formatted-single (fn [method-name [arg-vec & body]]
|
7034 |
| - [(munge method-name) |
7035 |
| - (apply list 'fn method-name (vec (concat ['this] arg-vec)) body)]) |
| 7039 | + (apply list |
| 7040 | + 'fn |
| 7041 | + method-name |
| 7042 | + (with-meta (vec (concat ['this] arg-vec)) (meta arg-vec)) |
| 7043 | + body)) |
7036 | 7044 | formatted-multi (fn [method-name & arities]
|
7037 |
| - [(munge method-name) |
7038 |
| - (apply list |
7039 |
| - 'fn |
7040 |
| - method-name |
7041 |
| - (map (fn [[arg-vec & body]] |
7042 |
| - (apply list (vec (concat ['this] arg-vec)) body)) |
7043 |
| - arities))]) |
7044 |
| - methods (map (fn [[method-name & body]] |
7045 |
| - (if (vector? (first body)) |
7046 |
| - (formatted-single method-name body) |
7047 |
| - (apply formatted-multi method-name body))) |
| 7045 | + (apply list |
| 7046 | + 'fn |
| 7047 | + method-name |
| 7048 | + (map (fn [[arg-vec & body]] |
| 7049 | + (apply list |
| 7050 | + (with-meta (vec (concat ['this] arg-vec)) (meta arg-vec)) |
| 7051 | + body)) |
| 7052 | + arities))) |
| 7053 | + methods (map (fn [[method-name & body :as form]] |
| 7054 | + [(munge method-name) |
| 7055 | + (with-meta |
| 7056 | + (if (vector? (first body)) |
| 7057 | + (formatted-single method-name body) |
| 7058 | + (apply formatted-multi method-name body)) |
| 7059 | + (meta form))]) |
7048 | 7060 | fs)
|
7049 | 7061 | method-map (reduce* (fn [m [method-name method]]
|
7050 | 7062 | (if-let [existing-method (get m method-name)]
|
|
0 commit comments