From d24eda3f5a8093cd5e3316453f170de659c75586 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Sun, 3 Feb 2008 09:58:17 +0100 Subject: Update documentation. darcs-hash:af9cfdb8adda53a3459722f8156c54a3d31bfaf1 --- Lisp/method-invocation.lisp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'Lisp/method-invocation.lisp') diff --git a/Lisp/method-invocation.lisp b/Lisp/method-invocation.lisp index c0bad01..9aae94d 100644 --- a/Lisp/method-invocation.lisp +++ b/Lisp/method-invocation.lisp @@ -108,6 +108,20 @@ separating parts by hyphens works nicely in all of the `:INVERT`, *modern mode*. +## Note 2: + +Instead of using __invoke__, which is neither macro-friendly nor very +useful for method selection at run-time, you may **funcall** selectors +directly. Naturally, __apply__ works as well. + +The following calls are all equivalent: + + (invoke-by-name instance \"stringWithCString:encoding:\" \"Mulk.\" 4) + (invoke instance :string-with-c-string \"Mulk.\" :encoding 4) + (funcall (selector \"stringWithCString:encoding:\") instance \"Mulk.\" 4) + (apply (selector \"stringWithCString:encoding:\") (list instance \"Mulk.\" 4)) + + ## See also: __invoke-by-name__" @@ -168,6 +182,7 @@ are all equivalent: In fact, using __invoke-by-name__ is discouraged in favour of the latter form. + ## Rationale: Whereas __invoke__ tries to make writing as well as reading method -- cgit v1.2.3