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: order of evaluation Date: Mon, 17 Jun 2013 12:10:52 +0200 Message-ID: <87li6959oz.fsf@pobox.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1371463872 5375 80.91.229.3 (17 Jun 2013 10:11:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 17 Jun 2013 10:11:12 +0000 (UTC) To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Jun 17 12:11:13 2013 Return-path: Envelope-to: guile-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 1UoWP3-0003dX-JO for guile-devel@m.gmane.org; Mon, 17 Jun 2013 12:11:13 +0200 Original-Received: from localhost ([::1]:60562 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UoWP2-0002yV-KZ for guile-devel@m.gmane.org; Mon, 17 Jun 2013 06:11:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33999) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UoWOv-0002xZ-CK for guile-devel@gnu.org; Mon, 17 Jun 2013 06:11:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UoWOp-0007YD-NN for guile-devel@gnu.org; Mon, 17 Jun 2013 06:11:05 -0400 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:34730 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UoWOp-0007Xk-I7 for guile-devel@gnu.org; Mon, 17 Jun 2013 06:10:59 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 325E8BBC2 for ; Mon, 17 Jun 2013 06:10:56 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to :subject:date:message-id:mime-version:content-type; s=sasl; bh=c Zg6+CKQ9e/CLXdZ6o93e5xvbsk=; b=iR5DOhGBll6GkHlIIXxFaKFYXToJizXsd U7U4HKV/SciZeLG4eiPzUpJ6ekOwLD4f7o/6+G142nfuS+4iJ3Rp44uEVUuuKQDt IpkhwxZoRSdbSZPJVLdDYHXi4aRxasBWk1XQycvnlGPBqN5aPGTf8xF/wQAFSpJr YA1EmvQojM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:subject :date:message-id:mime-version:content-type; q=dns; s=sasl; b=o/0 HvPVXRdXA03BT2RHr26f1C7AB3Ac/dba6JWn3iEanJRVWnZyAsnn7OYMO1mlZbxV ZoLomrfFLTdURu/0172Qlll2MwMDasB3DmbUTq/NtjpV/n3cuT9YThaDuMF/0xj8 /oToX4j96DtXcYi4zMTPbb4MWnz28TuJgdC+NN+4= Original-Received: from a-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 29223BBC1 for ; Mon, 17 Jun 2013 06:10:56 -0400 (EDT) Original-Received: from badger (unknown [88.160.190.192]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id A18AEBBC0 for ; Mon, 17 Jun 2013 06:10:55 -0400 (EDT) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-Pobox-Relay-ID: 32F76ACE-D736-11E2-8BF2-9F710E5B5709-02397024!a-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 208.72.237.25 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:16492 Archived-At: I really enjoy the unspecified order of evaluation that Scheme has, but perhaps that's an implementor's perspective. So I thought that when we went to convert to an intermediate form that names all intermediary values like ANF or CPS, that we'd be able to preserve this; but it turns out that it's not possible with ANF: This transformation for example is incorrect: (foo (a (b)) (c (d))) => (let ((B (b)) (D (d))) (let ((A (a B)) (C (c D))) (foo A C))) This is incorrect because it interleaves evaluation of the first and second argument, which is not permitted by Scheme, and is silly anyway: it introduces order-of-evaluation restrictions: evaluation of (d) and (a B) is not specified in the original form, but is in this second form. The normal way to do ANF is to choose an evaluation order: (let* ((B (b)) (A (a B)) (D (d)) (C (c D))) (foo A C)) This is better from a CSE perspective, but it does fix order of evaluation. Preserving order of evaluation agnosticism would be possible in a more direct-style IL: (let ((A (let ((B (b))) (a B))) (C (let ((D (d))) (c D)))) (foo A C)) Not sure what to do. The part of me that wants to do aggressive CSE wants to transform to a form that fixes order of evaluation, but the part of me that wants to be able to shuffle values using the Dybvig algorithm wants to do the direct form. Dunno! Andy -- http://wingolog.org/