From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Pascal J. Bourguignon" Newsgroups: gmane.emacs.help Subject: Re: How to quote a list of functions? Date: Mon, 17 Aug 2015 05:04:45 +0200 Organization: Informatimago Message-ID: <87mvxqbooi.fsf@kuiper.lan.informatimago.com> References: <871tfdjqjx.fsf@mbork.pl> <8737zs7uq3.fsf@mbork.pl> <87zj1vddkz.fsf@kuiper.lan.informatimago.com> <87mvxug2us.fsf@nl106-137-147.student.uu.se> <87vbch1gb0.fsf@nl106-137-147.student.uu.se> <87wpwudby7.fsf@nl106-137-147.student.uu.se> <87zj1qbwxs.fsf@kuiper.lan.informatimago.com> <87r3n2btjl.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1439780722 5956 80.91.229.3 (17 Aug 2015 03:05:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 17 Aug 2015 03:05:22 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Aug 17 05:05:18 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 1ZRAjd-0005j5-Ut for geh-help-gnu-emacs@m.gmane.org; Mon, 17 Aug 2015 05:05:18 +0200 Original-Received: from localhost ([::1]:54009 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRAjd-0005Yx-3k for geh-help-gnu-emacs@m.gmane.org; Sun, 16 Aug 2015 23:05:17 -0400 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 111 Original-X-Trace: individual.net RKIXmGOaA/lkpO2wrF+/8gxUFfW0zGseB1516Uf1JTzibX96Cl Cancel-Lock: sha1:NDRmOTk5Y2RlNzIwOTUyODI1ZDYzZjFkN2JiYmE3MmZhN2FhYzQzNA== sha1:D3OEundFkaEW2zhHsG47McsNzoI= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:214356 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:106640 Archived-At: Emanuel Berg writes: > "Pascal J. Bourguignon" > writes: > >> put doesn't take functions and neither does it take >> function designators. > > But it does accept functions, as that piece of code > shows, so the sharp quote syntax is even more > confusing/tedious/error-prone as it separates > functions from symbols, only that shouldn't always be > done, as it depends on the function that gets the > symbols (or functions as symbols) as well! > > It is very much to think about compared to just > typing: > > ;; enable commands > (put 'upcase-region 'disabled nil) > (put 'downcase-region 'disabled nil) > (put 'erase-buffer 'disabled nil) > (put 'suspend-frame 'disabled t ) > > Here, everyone immediately understands that > `upcase-region' is a function and that isn't disabled > anymore. NO! This is the point exactly! upcase-region is NOT a function. It is a symbol that _designates_ a function. You could as well add a disabled key on the plist of a symbol that doesn't designate any function. You could use this key for something else, for example, here I "disable" a variable: (defvar smurf 42) (defun smurf () (unless (get 'smurf 'disabled) smurf)) (put 'smurf 'disabled t) (smurf) ; --> nil (put 'smurf 'disabled nil) (smurf) ; --> 42 To begin with, what such put expression do, is not to disable functions, but to "disable" commands (which are some kind of functions). But this is done by way of the symbol designating the command, and assuming some function somewhere _interprets_ this property attached to that _symbol_. Above it was my function named by the symbol smurf that interpreted it for a variable named by the symbol smurf. (defun smurf () (interactive) (message "Smurfed!")) (setf (symbol-function 'azrael) (symbol-function 'smurf)) (put 'smurf 'disabled t) (smurf) ; --> "Smurfed!" (azrael) ; --> "Smurfed!" M-x smurf RET --> "You have typed RET, invoking a disabled command…" M-x azrael RET and you get "Smurfed!" in the *Message* buffer and echo area. There is a single function object for two symbols designating it: (eq (symbol-function 'smurf) (symbol-function 'azrael)) ; --> t This demonstrate clearly that the mechanism to disable command is not related to the command (or function), but to the symbol naming the command. > The special syntax for functions, which > shouldn't even be used, would, if used, not clarify > that one bit in my eyes/fingers. Of course. >> The thing is that the implementation of those >> "notions" or "data abstractions" that are _symbols_, >> _functions_ and _function designator_ can, did, and >> will change, across time and space (space being >> different lisp implementations). >> >> On the other hand, the "functional abstractions" >> such as put don't change. > > I never worry what will happen. When it does, I'll > make it work, then. People always tells me my code > will break, but it never did. Or maybe it did and > I fixed it, I don't know. Of course, it depends on how many successive versions of OS and platforms you had to pass thru. All I can say, is that an application that I wrote on MacOS worked perfectly thru all versions of MacOS till the version 9, while most other developers were quite surprised to see they had to patch their application each time a new version of the system was released. Either you respect the contract (specifications), or you don't and you will suffer. -- __Pascal Bourguignon__ http://www.informatimago.com/ “The factory of the future will have only two employees, a man and a dog. The man will be there to feed the dog. The dog will be there to keep the man from touching the equipment.” -- Carl Bass CEO Autodesk