From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.user Subject: Re: Using guile as an extension language for GNU make Date: Tue, 20 Sep 2011 22:42:31 -0400 Message-ID: <87r53aty3s.fsf@yeeloong.netris.org> References: <1316304616.28907.118.camel@homebase> <87wrd5x404.fsf@ambire.localdomain> <1316374080.28907.163.camel@homebase> <87sjntwf29.fsf@ambire.localdomain> <1316445274.28907.174.camel@homebase> <6D40BC91-6E4B-4799-BE29-BD2FF6EEEB84@telia.com> <1316469386.27584.30.camel@psmith-ubeta> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1316572998 2652 80.91.229.12 (21 Sep 2011 02:43:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 21 Sep 2011 02:43:18 +0000 (UTC) Cc: guile-user@gnu.org, Thien-Thi Nguyen , Hans Aberg To: psmith@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Sep 21 04:43:14 2011 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R6CmH-0008H3-NZ for guile-user@m.gmane.org; Wed, 21 Sep 2011 04:43:13 +0200 Original-Received: from localhost ([::1]:54824 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6CmH-0007sg-AL for guile-user@m.gmane.org; Tue, 20 Sep 2011 22:43:13 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:46376) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6CmB-0007sF-QB for guile-user@gnu.org; Tue, 20 Sep 2011 22:43:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R6CmA-00018K-GK for guile-user@gnu.org; Tue, 20 Sep 2011 22:43:07 -0400 Original-Received: from world.peace.net ([96.39.62.75]:36874) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6Cm9-00017F-7n; Tue, 20 Sep 2011 22:43:05 -0400 Original-Received: from 209-6-55-18.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.55.18] helo=yeeloong.netris.org) by world.peace.net with esmtpa (Exim 4.69) (envelope-from ) id 1R6Cls-0005hq-W1; Tue, 20 Sep 2011 22:42:49 -0400 Original-Received: from mhw by yeeloong.netris.org with local (Exim 4.72) (envelope-from ) id 1R6Clc-0004aM-47; Tue, 20 Sep 2011 22:42:32 -0400 In-Reply-To: <1316469386.27584.30.camel@psmith-ubeta> (Paul Smith's message of "Mon, 19 Sep 2011 17:56:26 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 96.39.62.75 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:8821 Archived-At: Hi Paul, Thanks for working on this! :) Paul Smith writes: > So far, I have these translations (see the C code I posted earlier): > > t => "t" (for make conditionals, non-empty is true) > nil => "" (for make conditionals, empty is false) Note that in modern Scheme, t and nil are just ordinary symbols, and not booleans. #t and #f are the boolean values, though Guile also includes #nil in order to support other Lisps (notably Emacs Lisp). The proper way to test for either #nil or #f from C is to use "scm_is_false". > "string" => "string" > 'symbol => "symbol" > 1234 => "1234" > > I can see that it would be nice to be able to translate: > > '(a b c) => "a b c" This all sounds great. > But what about more complex structures like lists of lists? What about > simple pairs; should '(a . b) => "a b" as well? Lists of words are just > about all make knows about so maybe the answer is yes. I'd recommend limiting the automatic conversion of list structure to only proper lists of atoms, and to otherwise raise an exception. For unusual cases, it's easy enough to flatten the list (or even convert it to a string) from within Scheme. > And finally, currently I have all unknown types expanding to the empty > string but now I'm thinking it would be better to start out more > restrictive and throw errors. This would ensure that people write their > Guile scripts correctly (giving valid return values) from the start, and > would let me, in the future, expand the supported types without breaking > anything. I agree wholeheartedly. If you are too permissive, it may cause programming errors to go unnoticed. It's better to limit the automatic conversions to common cases that are clearly useful. The other cases can be handled easily from Scheme. As for the suggestion to look at the pretty-printing library: I don't see why that would be useful. The purpose of that library is primarily to intelligently choose where to insert newlines in nested list structure, so that lines don't grow too long for the terminal display, and to add indentation as would be found in typical Scheme source code. It seems to me that these functions are undesirable for this purpose. Best, Mark