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: Wed, 7 Aug 2013 21:59:01 +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 1375905578 16897 80.91.229.3 (7 Aug 2013 19:59:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 7 Aug 2013 19:59:38 +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 Wed Aug 07 21:59:40 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 1V79tU-00055n-0n for ged-emacs-devel@m.gmane.org; Wed, 07 Aug 2013 21:59:40 +0200 Original-Received: from localhost ([::1]:41594 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V79tT-0005W5-Np for ged-emacs-devel@m.gmane.org; Wed, 07 Aug 2013 15:59:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V79tO-0005Vu-VM for emacs-devel@gnu.org; Wed, 07 Aug 2013 15:59:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V79tM-0006xE-BQ for emacs-devel@gnu.org; Wed, 07 Aug 2013 15:59:34 -0400 Original-Received: from mail-vb0-x22d.google.com ([2607:f8b0:400c:c02::22d]:46479) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V79tM-0006xA-7H for emacs-devel@gnu.org; Wed, 07 Aug 2013 15:59:32 -0400 Original-Received: by mail-vb0-f45.google.com with SMTP id e15so2327340vbg.32 for ; Wed, 07 Aug 2013 12:59:31 -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=AMOzd2JGT8AeE+njThJfikDrnKM9Yi9JZ5JtZ0jQSds=; b=YrM/AkRhcPxRDLMGj/i8RwqkPHs9IhNQYZCYur9EJXeulsdxb6UR6JgDKYVrgN3fh9 hWt0/QK6srKzEbvMl8KOEQTPYsV8q5GJbVCLft4JXBck28/Fazv25Cx3SbX6FwIIEi8K KHWkZguz47urzKn0HxqerQW+H9DlWITagP/p0RekR5k7VM9BRhGqNbUEVqxODY5LoFHe PxDAtVdKc/2+1MUFCPUvyR/L+e42yQEkhVAJqKxByNqyku3psfV4dkEVwKkVMHSnF3OB 2TTyA9LonUXzn7DuCtCb1JUip1fRCdiVCVcfnvP/bDmt9j8ECnE41AUfh+MiBZPbLPeT Plxg== X-Received: by 10.52.75.4 with SMTP id y4mr1094578vdv.118.1375905571734; Wed, 07 Aug 2013 12:59:31 -0700 (PDT) Original-Received: by 10.220.38.194 with HTTP; Wed, 7 Aug 2013 12:59:01 -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:c02::22d 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:162470 Archived-At: 2013/8/7 Stefan Monnier : >> The patch only adds a single line of code to byte-compile-normal-call >> which calls defun byte-compile--higher-order--check-arguments. > > But there's no normal call in (if a #'foo1 #'foo2), so how can this work? > > > Stefan Good point. It does though. Input file: -------------------------------------------------- ;; -*- mode:emacs-lisp;coding:utf-8-unix;lexical-binding:t;byte-compile-dynamic:t; -*- (funcall (if t #'foo) "Hello World") -------------------------------------------------- Compiler Log: -------------------------------------------------- Compiling file c:/tmp/id1379159421d7d15c.el at Wed Aug 7 21:53:58 2013 In end of data: id1379159421d7d15c.el:4:1:Warning: the function `foo' is not known to be defined. -------------------------------------------------- I guess the use of the function just doesn't match its name? - Klaus