(defsubclass relname [base & ctor-fn-targets] fields & opts+specs)
Defines a subclass of supcls
with the given added fields and overridden methods.
all usual options apply and the mutable fields can still be set in the bodies as per usual.
The class will implement all the constructors of the base, with the extra fields
added as head parameters; if any ctor-fn-targets
are specified, a ->relname fn
will be defined as well which forwards to the appropriate ctor; it is recommended that
if none are listed, a custom ctor fn is still defined for the sake of repl-friendliness.
Unlike -say- a Proxy output, the output class can be inherited from with no friction if the ::extensible? option is specified to be truthy; however, it's still discouraged.
Defines a subclass of `supcls` with the given added fields and overridden methods. all usual options apply and the mutable fields can still be set in the bodies as per usual. The class will implement all the constructors of the base, with the extra fields added as head parameters; if any `ctor-fn-targets` are specified, a ->relname fn will be defined as well which forwards to the appropriate ctor; it is recommended that if none are listed, a custom ctor fn is still defined for the sake of repl-friendliness. Unlike -say- a Proxy output, the output class can be inherited from with no friction if the ::extensible? option is specified to be truthy; however, it's still discouraged.
(instance [supcls & ctor-args] & reify-syntax)
Evaluates to an instance of supcls
initialized with ctor-args
,
which can override its own methods like reify
does and implement more interfaces.
Super calls to public or protected methods are available via the super-call
macro.
Note that unlike in reify
, the output instance isn't an IObj
by default.
Note that the class of the output is left unspecified, so it mustn't be relied upon.
Evaluates to an instance of `supcls` initialized with `ctor-args`, which can override its own methods like `reify` does and implement more interfaces. Super calls to public or protected methods are available via the `super-call` macro. Note that unlike in `reify`, the output instance isn't an `IObj` by default. Note that the class of the output is left unspecified, so it mustn't be relied upon.
(super-call [m targ & args :as wrapped])
Akin to calling a super
method in Java.
Behavior for calls outside of instance
and defsubclass
impl bodies is unspecified.
Akin to calling a `super` method in Java. Behavior for calls outside of `instance` and `defsubclass` impl bodies is unspecified.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close