From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Artur Malabarba Newsgroups: gmane.emacs.devel Subject: Re: eval-when-load? Date: Thu, 16 Jul 2015 19:13:10 +0100 Message-ID: References: <86fv4ohxjv.fsf@stephe-leake.org> Reply-To: bruce.connor.am@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1437070404 23703 80.91.229.3 (16 Jul 2015 18:13:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 16 Jul 2015 18:13:24 +0000 (UTC) Cc: emacs-devel To: Stephen Leake Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 16 20:13:23 2015 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 1ZFner-0002DT-QP for ged-emacs-devel@m.gmane.org; Thu, 16 Jul 2015 20:13:21 +0200 Original-Received: from localhost ([::1]:41429 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFner-0003uD-3v for ged-emacs-devel@m.gmane.org; Thu, 16 Jul 2015 14:13:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFnem-0003tr-9Z for emacs-devel@gnu.org; Thu, 16 Jul 2015 14:13:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZFneh-0007iM-Vx for emacs-devel@gnu.org; Thu, 16 Jul 2015 14:13:16 -0400 Original-Received: from mail-la0-x236.google.com ([2a00:1450:4010:c03::236]:34615) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFneh-0007iE-O8 for emacs-devel@gnu.org; Thu, 16 Jul 2015 14:13:11 -0400 Original-Received: by lagx9 with SMTP id x9so48254096lag.1 for ; Thu, 16 Jul 2015 11:13:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=H2HGOe5UoDQqoz3S5W4APGJCc+zRAfUL2W0pHRIswaY=; b=Vsyet2SwzmY0BSILDknBK1n2v5yPPmRYLv8WCE+vCyJAQ1vR4J5W5+dlA+b67oXFjX 9UmixpaYmc8enwOt30AHjNmvfU0QhD/yMwAwc2tyuV+172MGYRtkklCpXpDMt4yejtA9 c5vl8EFB9uKlxqwxswiaFuITE8miJRWGXs2EPSm+2wX+/dsS/Quh8ZgPomBbC7U685yG uPsxspPMPPofLz2D9w00k+H3cHvUKO5wplt391VkTHEbUFujR6OIsuAtAhLxX/8H2ZRO 1ICdqEMEZWTKTC8CsEnu5d6E6GhnOIAEQUB6NeuEE00gJbcZvIEPVc3JJCE3c+HJpI7B zGKw== X-Received: by 10.112.126.101 with SMTP id mx5mr10769999lbb.35.1437070390601; Thu, 16 Jul 2015 11:13:10 -0700 (PDT) Original-Received: by 10.25.214.133 with HTTP; Thu, 16 Jul 2015 11:13:10 -0700 (PDT) In-Reply-To: <86fv4ohxjv.fsf@stephe-leake.org> X-Google-Sender-Auth: 0pl5C8d-7kKHRt-FerrxrNnqX6s X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::236 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:187907 Archived-At: Is jde-jdhelper a macro? If it's a function the behavior you're asking about is the default. For instance, if I add (defvar oi (mapcar 'car nil)) to a file and compile it, the byte-compiled file will be identical. 2015-07-16 17:33 GMT+01:00 Stephen Leake : > A project I'm working on has a form like this at top level in a file: > > (defvar jde-jdhelper-singleton (jde-jdhelper nil) > "The JDHelper singleton instance.") > > `jde-jdhelper' can throw an error, which it does during byte-compile (it > complains about not finding "wget"). > > We want the variable defined at load time, and we want the error at load > time, but we don't care at compile time. > > So I'd like to do: > > (eval-when-load > (defvar jde-jdhelper-singleton (jde-jdhelper nil) > "The JDHelper singleton instance.")) > > but `eval-when-load' is not defined. > > Is there a work-around? > > We could change the var to a function that checks if the initialization > is done, but that seems a heavy solution. > > -- > -- Stephe >