From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: Elisp lexical-let Date: Thu, 23 Jul 2009 22:53:22 +0200 Message-ID: References: <4A661B73.4090706@domob.eu> <4A66D7BF.5060606@domob.eu> <4A670D78.3040804@gentoo.org> <4A67676F.9010905@domob.eu> <4A6880AE.9070600@gentoo.org> <20090723161313.GA1405@fibril.netris.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1248383393 3890 80.91.229.12 (23 Jul 2009 21:09:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 23 Jul 2009 21:09:53 +0000 (UTC) Cc: guile-devel , Neil Jerram , Daniel Kraft , Ken Raeburn To: Mark H Weaver Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Jul 23 23:09:46 2009 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MU5Xm-0000iC-0S for guile-devel@m.gmane.org; Thu, 23 Jul 2009 23:09:38 +0200 Original-Received: from localhost ([127.0.0.1]:53914 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MU5Xl-00040U-Bk for guile-devel@m.gmane.org; Thu, 23 Jul 2009 17:09:37 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MU5XT-0003wB-Ob for guile-devel@gnu.org; Thu, 23 Jul 2009 17:09:19 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MU5XP-0003uR-9O for guile-devel@gnu.org; Thu, 23 Jul 2009 17:09:19 -0400 Original-Received: from [199.232.76.173] (port=35708 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MU5XO-0003uI-Uz for guile-devel@gnu.org; Thu, 23 Jul 2009 17:09:14 -0400 Original-Received: from a-sasl-quonix.sasl.smtp.pobox.com ([208.72.237.25]:61807 helo=sasl.smtp.pobox.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MU5XO-0001ig-GC for guile-devel@gnu.org; Thu, 23 Jul 2009 17:09:14 -0400 Original-Received: from localhost.localdomain (unknown [127.0.0.1]) by a-sasl-quonix.sasl.smtp.pobox.com (Postfix) with ESMTP id ED90F11FBD; Thu, 23 Jul 2009 17:09:13 -0400 (EDT) Original-Received: from unquote (unknown [81.38.186.175]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-sasl-quonix.sasl.smtp.pobox.com (Postfix) with ESMTPSA id 76FC211FBA; Thu, 23 Jul 2009 17:09:06 -0400 (EDT) In-Reply-To: <20090723161313.GA1405@fibril.netris.org> (Mark H. Weaver's message of "Thu, 23 Jul 2009 12:13:13 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) X-Pobox-Relay-ID: 13118EC8-77CD-11DE-84FC-F699A5B33865-02397024!a-sasl-quonix.pobox.com X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (beta) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:8930 Archived-At: Hi, Just for the record :) On Thu 23 Jul 2009 18:13, Mark H Weaver writes: > On Thu, Jul 23, 2009 at 05:24:30PM +0200, Marijn Schouten (hkBst) wrote: >> For the calls above all the dynamic accesses can be determined statically. >> Lexical accesses can always be determined statically. Thus all accesses in this >> example can be determined statically and can be compiled to a location >> dereference (either read or write). Nothing in the semantics is inherently >> inefficient. > > There is at least one inherent loss of efficiency with the semantics > you propose: with a lexical-let binding, the compiler can determine > statically whether the variable is non-mutable, because the only place > it could possibly be set! is within the lexical scope. Non-mutable > variables can safely be inlined, an especially important optimization, > especially if the value is a procedure. Guile does detect this. The useful optimization is that variables that are never set! can be allocated on the stack, and if they're closed over, they can simply be copied. > Also, with lexical-let, the compiler knows statically the entire set > of references, which can be helpful with many analyses, for example > whether continuations or closures can "escape" a particular scope, > whether a particular continuation might be invoked more than once, > etc. This is a more tricky optimization :) Andy -- http://wingolog.org/