From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: emacs lisp syntax rfc: (cond (EXPR => (lambda (X) ...))) Date: Wed, 05 Jan 2011 19:10:42 -0500 Message-ID: References: <87tyhoa67u.fsf@ambire.localdomain> <20110105.234046.1611011828799323301.hanche@math.ntnu.no> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1294272660 14143 80.91.229.12 (6 Jan 2011 00:11:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 6 Jan 2011 00:11:00 +0000 (UTC) Cc: emacs-devel@gnu.org To: Harald Hanche-Olsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 06 01:10:56 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PadRN-0007KF-Mi for ged-emacs-devel@m.gmane.org; Thu, 06 Jan 2011 01:10:54 +0100 Original-Received: from localhost ([127.0.0.1]:47061 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PadRN-0003Cw-2q for ged-emacs-devel@m.gmane.org; Wed, 05 Jan 2011 19:10:53 -0500 Original-Received: from [140.186.70.92] (port=58128 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PadRG-0003CF-9Q for emacs-devel@gnu.org; Wed, 05 Jan 2011 19:10:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PadRF-00084y-18 for emacs-devel@gnu.org; Wed, 05 Jan 2011 19:10:45 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:19350 helo=ironport2-out.pppoe.ca) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PadRE-00083s-Pi for emacs-devel@gnu.org; Wed, 05 Jan 2011 19:10:44 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAL6WJE1Ld/TY/2dsb2JhbACkG3S+cYVMBIRojiA X-IronPort-AV: E=Sophos;i="4.60,280,1291611600"; d="scan'208";a="87180209" Original-Received: from 75-119-244-216.dsl.teksavvy.com (HELO pastel.home) ([75.119.244.216]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 05 Jan 2011 19:10:43 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id C271A58D59; Wed, 5 Jan 2011 19:10:42 -0500 (EST) In-Reply-To: <20110105.234046.1611011828799323301.hanche@math.ntnu.no> (Harald Hanche-Olsen's message of "Wed, 05 Jan 2011 23:40:46 +0100 (CET)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:134315 Archived-At: > However, it seems to me that we are now coming up with rather > convoluted schemes in which scoping become far from obvious, > especially to someone unfamiliar with this particular lisp. Agreed. A slightly more sane syntax could be (cond (foo bar) (:let var exp1) (exp2 bla... var ...bla) (bli... var ...bli) ...) but it's still not very convincing. > Also, I wonder what is so special about cond, anyhow? It's often useful to use cond to syntactically list various alternatives. But if some of conds need the same sub-expression and that sub-expression is not always computed, you get into a funny situation where you need to use (let (var) ... (setq var ...) ...) I.e. separate the declaration of a variable from its initialization, which is ugly and introduces side-effects even for a variable which often could/should really be immutable. Lazy languages solve this by letting the user do (let ((var exp1)) ... ...var... ...) and have exp1 only evaluated the first time var is used. But we don't want to add laziness, do we? Stefan