From: "Eric M. Ludlam" <eric@siege-engine.com>
To: rms@gnu.org
Cc: jasonr@gnu.org, lennart.borgman@gmail.com, sdl.web@gmail.com,
monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re[2]: Multiple major modes
Date: Wed, 4 Jul 2007 21:44:24 -0400 [thread overview]
Message-ID: <200707050144.l651iOeu023173@projectile.siege-engine.com> (raw)
In-Reply-To: <E1I56DN-0006bY-H2@fencepost.gnu.org> (message from Richard Stallman on Sun, 01 Jul 2007 16:40:13 -0400)
>>> Richard Stallman <rms@gnu.org> seems to think that:
> The function overload mechanism is also a feature I use in semantic.
> Most features that work in multiple major modes today provide a
> variable where you can put a symbol that is a function that would then
> provide some mode-specific functionality.
>
> My semantic tool has hundreds of these functions, so I abstracted the
> concept up so that the implementations could be declarative, instead
> of programmatic.
>
>I really don't like the idea of function overloads. This mechanism
>shares the drawbacks of advice: that a function doesn't do what its
>definition says.
>
> It also makes it easy to make most functions
> overridable, which helps avoid forcing users to use advice when
> customizing my tool.
>
>It is easy to replace advising with another similar mechanism,
>but it doesn't solve the problem.
>
>It seems to me that there is no need for this. Calling a variable
>with funcall should do the same job. That way, the call _shows_
>that the function isn't fixed.
The use syntax of an overloadable function is similar to programs that
call `indent-for-tab-command', or `indent-according-to-mode', but
there is no restriction forcing `according-to-mode' as part of the
function name.
The difference between writing an `indent-according-to-mode'
function and an overload function is that you don't have to write the
body of the function or, in the specific case of
`indent-according-to-mode', you could write a body that wraps up an
:overload token similar to the way `indent-according-to-mode' wraps
the `funcall'.
Anyway, I think these overload functions are more like methods which
dispatch on major mode instead of advice. You can advise any
function, but you can only overload something created with
`define-overload', so it is known via syntactic sugar instead of a
funcall call.
When it comes right down to it though, this is not needed for multiple
major modes where one of the concerns is buffer-local vs mode-local
variables, and I don't want to imply that I think it is needed. It is
only a feature which I feel has enhanced the maintainability of my
code, and has helped others understand and discover how to extend my
tools for different modes.
Eric
--
Eric Ludlam: zappo@gnu.org, eric@siege-engine.com
Home: http://www.ludlam.net Siege: www.siege-engine.com
Emacs: http://cedet.sourceforge.net GNU: www.gnu.org
next prev parent reply other threads:[~2007-07-05 1:44 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-11 23:27 Should nXML be included Leo
2007-06-12 10:50 ` Lennart Borgman (gmail)
2007-06-12 11:21 ` Jason Rumney
2007-06-12 12:57 ` Lennart Borgman (gmail)
2007-06-12 13:42 ` Peter Heslin
2007-06-12 14:20 ` Jason Rumney
2007-06-12 15:06 ` Multiple major modes (was: Should nXML be included) Stefan Monnier
2007-06-12 15:15 ` Multiple major modes Leo
2007-06-12 18:48 ` Lennart Borgman (gmail)
2007-06-12 20:14 ` Re[2]: " Eric M. Ludlam
2007-06-12 21:04 ` Lennart Borgman (gmail)
2007-06-12 23:10 ` Stefan Monnier
2007-06-13 16:22 ` Richard Stallman
2007-06-13 16:22 ` Richard Stallman
2007-06-19 2:09 ` Re[2]: " Eric M. Ludlam
2007-06-24 14:41 ` Richard Stallman
2007-06-25 14:04 ` Re[2]: " Eric M. Ludlam
2007-07-01 20:40 ` Richard Stallman
2007-07-05 2:29 ` Re[2]: " Eric M. Ludlam
2007-07-05 20:34 ` Richard Stallman
2007-07-01 20:40 ` Richard Stallman
2007-07-04 16:35 ` T. V. Raman
2007-07-04 17:01 ` David Kastrup
2007-07-05 1:31 ` Richard Stallman
2007-07-05 14:49 ` Stefan Monnier
2007-07-06 4:38 ` Richard Stallman
2007-07-06 6:01 ` Stephen J. Turnbull
2007-07-07 13:07 ` Richard Stallman
2007-07-07 14:13 ` Lennart Borgman (gmail)
2007-07-08 16:56 ` Richard Stallman
2007-09-04 9:03 ` Highlight advice (was: Multiple major modes) Johan Bockgård
2007-07-07 17:43 ` Multiple major modes Stephen J. Turnbull
2007-07-06 16:00 ` Stefan Monnier
2007-07-06 16:10 ` Drew Adams
2007-07-07 13:06 ` Richard Stallman
2007-07-07 17:21 ` Stephen J. Turnbull
2007-07-08 16:55 ` Richard Stallman
2007-07-09 5:29 ` Stephen J. Turnbull
2007-07-09 17:21 ` Richard Stallman
2007-07-07 0:48 ` Johan Bockgård
2007-07-05 1:44 ` Eric M. Ludlam [this message]
2007-07-08 22:23 ` Richard Stallman
2007-07-09 0:49 ` Re[2]: " Eric M. Ludlam
2007-07-09 17:21 ` Richard Stallman
2007-06-12 13:26 ` Should nXML be included Stefan Monnier
2007-06-12 13:16 ` Peter Heslin
2007-06-12 13:11 ` Leo
2007-06-12 13:59 ` joakim
2007-06-12 14:17 ` Peter Heslin
2007-06-12 14:14 ` David Kastrup
2007-06-12 15:11 ` Stefan Monnier
2007-06-13 8:06 ` Richard Stallman
2007-06-13 17:45 ` Claus
2007-06-14 16:19 ` Richard Stallman
2007-06-14 16:28 ` Leo
2007-06-15 19:21 ` Richard Stallman
2007-06-14 17:44 ` Eric Hanchrow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200707050144.l651iOeu023173@projectile.siege-engine.com \
--to=eric@siege-engine.com \
--cc=emacs-devel@gnu.org \
--cc=jasonr@gnu.org \
--cc=lennart.borgman@gmail.com \
--cc=monnier@iro.umontreal.ca \
--cc=rms@gnu.org \
--cc=sdl.web@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.