.. include:: ../global.rst .. idio:currentmodule:: object IOS Functions ------------- .. _`object/class-instance`: .. idio:function:: object/class-instance name [args] return the instance of the class `name` :param name: name of the class or the class instance :type name: symbol or instance :return: class :rtype: instance ``class-instance`` is usually used in templates to map the supplied class names into class instances. Circumstances might be such that it is called in regular flow where the class' name has been evaluated to the class instance in which case ``class-instance`` simply returns the class instance. .. _`object/add-method!`: .. idio:function:: object/add-method! gf m add method `m` to generic function `gf`'s list of methods :param gf: generic function :type gf: instance :param m: method :type m: instance :return: ``#`` `m` will override any existing method with the same specializers ``add-method!`` would not normally be called by users as methods are implicitly added through the use of :ref:`define-method `. .. seealso:: :ref:`define-method ` .. _`object/instance-of?`: .. idio:function:: object/instance-of? o cl test if `o` is an instance of class `cl` :param o: object to test :param cl: class to test :type cl: class :return: ``#t`` if `o` is an instance of `cl`, ``#f`` otherwise .. _`object/slot-ref`: .. idio:function:: object/slot-ref obj slot return the value of slot `slot` in `obj` :param obj: object :type obj: instance :param slot: slot name :type slot: symbol :return: value :raises ^rt-slot-not-found-error: .. _`object/slot-set!`: .. idio:function:: object/slot-set! obj slot val set the value of slot `slot` in `obj` to `val` :param obj: object :type obj: instance :param slot: slot name :type slot: symbol :param val: value :type val: any :return: ``#>`` :raises ^rt-slot-not-found-error: .. _`object/%cpl-args`: .. idio:function:: object/%cpl-args args An accelerator for .. code-block:: idio map (function (arg) (class-cpl (class-of arg))) args :param args: method arguments :type args: list :return: list of argument CPLs .. _`object/dump-instance`: .. idio:function:: object/dump-instance o dump instance `o` :param o: object :type o: instance :return: ``#`` .. include:: ../commit.rst