From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Klaus-Dieter Bauer Newsgroups: gmane.emacs.devel Subject: Re: Can the byte-compiler check whether functions passed by name are defined? Date: Mon, 5 Aug 2013 20:17:51 +0200 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1375726711 16732 80.91.229.3 (5 Aug 2013 18:18:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 5 Aug 2013 18:18:31 +0000 (UTC) Cc: Sebastian Wiesner , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 05 20:18:32 2013 Return-path: Envelope-to: ged-emacs-devel@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 1V6PMV-00054v-5Q for ged-emacs-devel@m.gmane.org; Mon, 05 Aug 2013 20:18:31 +0200 Original-Received: from localhost ([::1]:42538 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6PMU-000874-OJ for ged-emacs-devel@m.gmane.org; Mon, 05 Aug 2013 14:18:30 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6PMP-00086f-VZ for emacs-devel@gnu.org; Mon, 05 Aug 2013 14:18:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6PMM-0004ka-Ni for emacs-devel@gnu.org; Mon, 05 Aug 2013 14:18:25 -0400 Original-Received: from mail-ve0-x22a.google.com ([2607:f8b0:400c:c01::22a]:63172) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6PMM-0004kS-7N for emacs-devel@gnu.org; Mon, 05 Aug 2013 14:18:22 -0400 Original-Received: by mail-ve0-f170.google.com with SMTP id 15so3483030vea.15 for ; Mon, 05 Aug 2013 11:18:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=a8v+1w91Dm/0x9kPtPIl0cE+Wnjf+gIHtmDgexz7pUo=; b=H8s3WsN2i8gYnsNfI3+kwQbew4rlbAJdmJdrZ4R8hWkXp43GDDRey1fPENlMoM76AP k59C/XuG/YnnbVjaMKBCvWl/nnPrFUi8+AV35yBv9m9VqCJrscjsgkUJnUh5MKYx4R/p K8c8ordeFbqLCMgXXodt/usAwuAj7ebfEtwaQ6YI4EyqcIq9cIvAJl0ZrfGDDSn3MW0u 6dKy+5pyfK1UqqYTMBs79EwLskP3SEi6HKZBcIXf+v0K2y5U5s8RrcNwhV5cphUE2rl1 MBGGVVtOdYC7DTgckNd+HUZ4VtHW3+vRJWhiaVmHTKufhjTxNocDzuQCDynRM033m1YD SJWg== X-Received: by 10.52.232.165 with SMTP id tp5mr5164089vdc.11.1375726701782; Mon, 05 Aug 2013 11:18:21 -0700 (PDT) Original-Received: by 10.220.38.194 with HTTP; Mon, 5 Aug 2013 11:17:51 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400c:c01::22a X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:162441 Archived-At: 2013/8/5 Stefan Monnier : >> (mapcar (if flag 'f1 'f2) list) >> => (mapcar (if flag #'f1 #'f2) list) > > No, I definitely don't want to get into such fanciness. > But I do want compiler warnings if the coder writes > > (mapcar (if flag #'f1 #'f2) list) > > and `f1' or `f2' are unknown. My code does that and indeed that was, what I first implemented. I then added the second check, where (quote f1) is handled for functions known to be higher-order. >> Shouldn't the markup for user-written functions be a bit easier? > > I'm not too worried about it, no. We should instead aim to teach people > to write #'foo instead of 'foo. I am not sure about that... On the one hand, I see your point, since consistently writing #'function is better for the byte compiler, as in the (if flag #'f1 #'f2) form; If #'f1 is the standard method people will write (if flag 'f1 'f2) and not get a warning. On the other hand though, subjectively, #'f1 is a huge deal more visual clutter and somewhat awkward to type (on a German keyboard at least). Might be just a training effect, but I also feel that the hash-quote sequence moves the attention away from the function name, while 'f1 does not (or #f1, '#f1 for that matter, but those are not elisp). - Klaus