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: Lua Date: Mon, 14 Jun 2010 22:50:21 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1276548625 28569 80.91.229.12 (14 Jun 2010 20:50:25 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 14 Jun 2010 20:50:25 +0000 (UTC) Cc: guile-devel To: No Itisnt Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Jun 14 22:50:23 2010 connect(): No such file or directory 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.69) (envelope-from ) id 1OOGbu-0000T2-Jn for guile-devel@m.gmane.org; Mon, 14 Jun 2010 22:50:22 +0200 Original-Received: from localhost ([127.0.0.1]:58865 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OOGbt-0004KK-W7 for guile-devel@m.gmane.org; Mon, 14 Jun 2010 16:50:22 -0400 Original-Received: from [140.186.70.92] (port=33638 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OOGaS-00039X-Nh for guile-devel@gnu.org; Mon, 14 Jun 2010 16:48:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OOGaR-0006UY-Db for guile-devel@gnu.org; Mon, 14 Jun 2010 16:48:52 -0400 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:49826 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OOGaR-0006QT-BN for guile-devel@gnu.org; Mon, 14 Jun 2010 16:48:51 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 15831BCADE; Mon, 14 Jun 2010 16:48:14 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=axE0W7xXsbtDIyGgflrsk9tqUnM=; b=e+GwgY m9lx96geThH1QHn/c288/PlKzmAM/KaSgufEWEHwdLFmSHu5gAIi29Ac7rxq9JUN 1oRqJn6dJ2a6JoXXbkSvKB1QS0oelfWOoGqgohwM8oS/nflb8eJVVBJW2MdqRaWl c6d7xqN2z0qSCvZBEiuR1NlxxVg6ReXuQR1Aw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=jlncId4w4l2D+H2ifGXDi+558T9jrwB9 12dVYcHhR9hJQ0ouyW+0Qjmw0pn0AsbXzLB2Ef8J2Fn/NwjvBxaUYGhIk3pb4wU4 FYf0WRuGLQAgyVhqlrcyLOVR3D55KNpJrSg+0VWiLP0PAjlVO9NP4svZU9SID8C/ NRPIhEn3npk= Original-Received: from a-pb-sasl-quonix. (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id F265FBCADD; Mon, 14 Jun 2010 16:48:12 -0400 (EDT) Original-Received: from unquote (unknown [81.39.158.44]) (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 1E556BCADC; Mon, 14 Jun 2010 16:48:10 -0400 (EDT) In-Reply-To: (No Itisnt's message of "Sun, 13 Jun 2010 16:03:47 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) X-Pobox-Relay-ID: 261DE03C-77F6-11DF-9E86-9056EE7EF46B-02397024!a-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.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:10474 Archived-At: Hello! On Sun 13 Jun 2010 23:03, No Itisnt writes: > Hey, now would be a great time for a critique of my Lua project if you > are willing, so I can incorporate any criticisms or ideas you may have > before the GSOC midterm date. I'm closing in on finishing the base > language and I hope to complete it this week if time permits. Great news. I haven't had time to really dive in, but hope to do so towards the end of the week. > - I am using #nil for Lua's nil right now. Lua considers nil false for > the purpose of conditionals and it's also the value of unset variables > or table slots. Maybe it should be replaced with a gensym? I didn't > follow the Emacs nil thing very closely so I'm not sure whether that > approach might be problematic. It could be OK. #f would also be fine. Does this value have any other kinds of semantics? You will want to use an immediate like #f or nil or something, going through a symbol will be too slow. > - Lua represents numbers as the C 'double' type by default -- what's > the best way to approximate that in Guile? Hmm. Here I think we should use Guile's numbers by default. That way you get the speed of inums in most normal cases. You should probably coerce division into inexact numbers (i.e. 3 / 4 translating to the equivalent of (exact->inexact (/ 3 4))). Looking farther, having immediate (unboxed) floating point numbers might be a win. See the discussion in http://www.nue.riec.tohoku.ac.jp/ppl2008/proceedings/1-06.pdf; I don't think a special GC nursery is the right thing for us though. I'd rather try to tag immediate floating point numbers as in http://t-t-travails.blogspot.com/2007/07/tagged-unboxed-floating-point-numbers.html. > - How should I implement multiple return values? Lua allows multiple > variables to be assigned in a single statement, e.g. "a,b = c()", but > it's also permissive in that an assignment need not be balanced -- > there can be extra variables on the left or expressions on the right. > So I think I need to be able to inspect the return value of function > calls somewhat at runtime. I was hoping for something elegant but > perhaps I will just return vectors and inspect the return values of > functions at runtime. I don't know really. This was the sticking point for me when I looked at implementing Lua. It would be nice to avoid heap allocation... Here is one option: (letrec ((cont (case-lambda ((a b c) ; the expected number of values do-the-thing) (args ; some other number of values (cont (first-arg arg) (second-arg arg) (third-arg arg)))))) (call-with-values (lambda () right-hand-side ...) cont)) This should be optimizable in the future (in particular, rendering the case-lambda body inline, as normal lambdas are). Happy hacking, Andy -- http://wingolog.org/