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: Rationalising c[ad]\{2,5\}r. Date: Thu, 12 Mar 2015 10:15:52 +0000 Message-ID: References: <20150311214324.GA2952@acm.fritz.box> <87zj7jb2p2.fsf@zigzag.favinet> <20150311230054.GB2952@acm.fritz.box> <20150312085607.GA2625@acm.fritz.box> Reply-To: bruce.connor.am@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c34a0a3608de051114ab5b X-Trace: ger.gmane.org 1426155384 14257 80.91.229.3 (12 Mar 2015 10:16:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 12 Mar 2015 10:16:24 +0000 (UTC) Cc: emacs-devel To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 12 11:16:24 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 1YW0AB-00066z-SG for ged-emacs-devel@m.gmane.org; Thu, 12 Mar 2015 11:16:24 +0100 Original-Received: from localhost ([::1]:59014 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YW0AB-0000O4-2s for ged-emacs-devel@m.gmane.org; Thu, 12 Mar 2015 06:16:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34888) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YW09j-00083i-3F for emacs-devel@gnu.org; Thu, 12 Mar 2015 06:15:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YW09i-0002Qm-0D for emacs-devel@gnu.org; Thu, 12 Mar 2015 06:15:55 -0400 Original-Received: from mail-lb0-x22d.google.com ([2a00:1450:4010:c04::22d]:36345) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YW09h-0002Qe-NS for emacs-devel@gnu.org; Thu, 12 Mar 2015 06:15:53 -0400 Original-Received: by lbiz11 with SMTP id z11so14839211lbi.3 for ; Thu, 12 Mar 2015 03:15:53 -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=uHwelRqPv4ltyyk9V5H/lNJT9LnIYo7Z82+Sya2tP/0=; b=ADfZwO5TBIQskJWRjbWf1lI8iU/69nu2NpJIKtMJ4M5xt1PBiP7RhfxNfy4GE5/me+ 0iaVTzGyDsxpEsEsH3Wu2P9WBXIToPW3ypAYnFk/U2JmeydDQwiOxxQsreEfsHPMlVKK qLQv1NWBWkjwsufMO/GjpKkO/i/dCnjGzkg6B1IoTt+kzQ3BMaa/eV/E4sO1Ct2bivBa hluP7c9A51eedK0uxMYi7/7EnAmAknB8P5la03A3f+4+BrdcNKclWnU29TTXOaJ/X10k oO7YgZxl7nK7IEBM5ApzG3OAlFmSNJqbYLTILB7I/AtxhIMOXs6bkkOgDt/Mnev5hDEX 7M1g== X-Received: by 10.152.7.212 with SMTP id l20mr26884339laa.68.1426155353014; Thu, 12 Mar 2015 03:15:53 -0700 (PDT) Original-Received: by 10.112.207.225 with HTTP; Thu, 12 Mar 2015 03:15:52 -0700 (PDT) Original-Received: by 10.112.207.225 with HTTP; Thu, 12 Mar 2015 03:15:52 -0700 (PDT) In-Reply-To: <20150312085607.GA2625@acm.fritz.box> X-Google-Sender-Auth: nfBG4-3dU1lg0GQs5l73oQATYG0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::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:183807 Archived-At: --001a11c34a0a3608de051114ab5b Content-Type: text/plain; charset=UTF-8 Makes sense, thanks for the explanation. On Mar 12, 2015 8:56 AM, "Alan Mackenzie" wrote: > Hello, Artur. > > On Wed, Mar 11, 2015 at 09:52:07PM -0300, Artur Malabarba wrote: > > > Just one thing, though, since `number-sequence' is also defined in > > > subr.el, I'd have to wrap it in `eval-and-compile' to be able to use it > > > in my macros. > > > I don't understand. Why is that? > > Normally, during byte compilation, the newly compiled defuns and defvars > are simply written to the output file. They cannot be executed/accessed > until that file.elc is later loaded. > > This would be a problem for my macro `gen-cXXr-all', which wants to > _run_ `number-sequence' whilst subr.el is being compiled. The solution > is `eval-and-compile', which instructs the byte compiler both to write > the compiled `number-sequence' to the output file and to evaluate it, so > that it is available for use later during the compilation. > > I don't think this is particularly well described in the Elisp manual, > particularly with the sentence "Most uses of `eval-and-compile' are > fairly sophisticated.", which does sound a little patronising. > > -- > Alan Mackenzie (Nuremberg, Germany). > --001a11c34a0a3608de051114ab5b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Makes sense, thanks for the explanation.

On Mar 12, 2015 8:56 AM, "Alan Mackenzie&qu= ot; <acm@muc.de> wrote:
Hello, Artur.

On Wed, Mar 11, 2015 at 09:52:07PM -0300, Artur Malabarba wrote:
> > Just one thing, though, since `number-sequence' is also defin= ed in
> > subr.el, I'd have to wrap it in `eval-and-compile' to be = able to use it
> > in my macros.

> I don't understand. Why is that?

Normally, during byte compilation, the newly compiled defuns and defvars are simply written to the output file.=C2=A0 They cannot be executed/access= ed
until that file.elc is later loaded.

This would be a problem for my macro `gen-cXXr-all', which wants to
_run_ `number-sequence' whilst subr.el is being compiled.=C2=A0 The sol= ution
is `eval-and-compile', which instructs the byte compiler both to write<= br> the compiled `number-sequence' to the output file and to evaluate it, s= o
that it is available for use later during the compilation.

I don't think this is particularly well described in the Elisp manual,<= br> particularly with the sentence "Most uses of `eval-and-compile' ar= e
fairly sophisticated.", which does sound a little patronising.

--
Alan Mackenzie (Nuremberg, Germany).
--001a11c34a0a3608de051114ab5b--