From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Defining functions on the fly Date: Tue, 16 Jun 2015 21:12:27 -0400 Organization: A noiseless patient Spider Message-ID: References: <76f991fc-d00f-498f-b586-d8bb9ea96c20@googlegroups.com> <1a9b8f2a-8014-419a-91b1-e2413fe92e13@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1434503731 3049 80.91.229.3 (17 Jun 2015 01:15:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Jun 2015 01:15:31 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jun 17 03:15:23 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z51wk-000729-CF for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Jun 2015 03:15:18 +0200 Original-Received: from localhost ([::1]:43607 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z51wj-0007Ey-C1 for geh-help-gnu-emacs@m.gmane.org; Tue, 16 Jun 2015 21:15:17 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 26 Injection-Info: mx02.eternal-september.org; posting-host="57a6bd8b47e5d85183f0e9788fd6074b"; logging-data="13250"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18BLvJmGXymjWJvUCElifLg" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:cNtp6vHh9DmH6ldqyGJ0/6ww8JI= sha1:hePFdA5Ord0tapFbiJlWt7VsGcw= Original-Xref: usenet.stanford.edu gnu.emacs.help:212712 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:104996 Archived-At: >> > (fset (function name-of-function) >> [...] >> > (define name-of-function >> Actually, `fset' is more like Scheme's `set!', > How so? Exactly in the sense you describe: > `define' is typically used if or when a symbol has yet to be bound to > either a lambda function or value. > set! is used to destructively re-bind something to a symbol already > bound to something. `defun' macroexpands to `defalias' rather than to `fset'. >> so if it's the *definition* of a function, you should use `defalias' >> which is more like Scheme's `define'. > I don't see it that way, but if works to one's satisfaction then why not? Actually, they don't do the same thing. E.g. fset will throw away/override any advice you may have applied to that function, whereas defalias will combine the new definition with the pieces of advice. Stefan