From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.user Subject: Re: More Guile 1.8 code failing in 2.x Date: Wed, 27 Feb 2013 16:08:49 +0100 Message-ID: <87zjypu73y.fsf@pobox.com> References: <1361959643.2097.179.camel@debian-box.lan> <87mwupao7n.fsf@markwitmer.com> <1361974971.2097.194.camel@debian-box.lan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1361977775 7815 80.91.229.3 (27 Feb 2013 15:09:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Feb 2013 15:09:35 +0000 (UTC) Cc: mark@markwitmer.com, guile-user@gnu.org To: Richard Shann Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Feb 27 16:09:56 2013 Return-path: Envelope-to: guile-user@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 1UAido-0005Vk-9v for guile-user@m.gmane.org; Wed, 27 Feb 2013 16:09:56 +0100 Original-Received: from localhost ([::1]:52711 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAidT-0007Tn-A2 for guile-user@m.gmane.org; Wed, 27 Feb 2013 10:09:35 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:60680) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAicq-00070r-AZ for guile-user@gnu.org; Wed, 27 Feb 2013 10:09:01 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAico-0002T9-Ty for guile-user@gnu.org; Wed, 27 Feb 2013 10:08:56 -0500 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:44281 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAico-0002Sm-PT for guile-user@gnu.org; Wed, 27 Feb 2013 10:08:54 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 5E715B95F; Wed, 27 Feb 2013 10:08:52 -0500 (EST) 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=qeE58ZnHk6EyROxWvkdr5bF0NrI=; b=GpaEPe JySd4b3JDlEvaAsa6K2wvSX6YSSXZZshsfHUakmQUgVxPZOANEdiWize/uq4U6dL KbvqMMdIUXHtjxQXCQLHshmbQFyfGMhEbwX4sQdofC9YpKgk8QwsDbVBfYeVprSZ qLiWZfW/jIXb9eD6Cm2pHjWwwH8pZ038c0FcM= 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=Y6ZKM6H2KniIDY0uFk1gKUzU39Fq1J7H ySzXxyYU6/6MuRdQF1txzjW+4/M9RTtXYwl8OINW9xJzFt1/t8zA/BmyGIZ3ySMb T0YO/nbcIG8ssLf6VBBAw0h4UFR9YRbdYn27PJlnRmEeqNoA7E/EueRBZWOfj9Ej 2ykq6deKEZc= 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 57B8EB955; Wed, 27 Feb 2013 10:08:52 -0500 (EST) 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 B50AAB954; Wed, 27 Feb 2013 10:08:51 -0500 (EST) In-Reply-To: <1361974971.2097.194.camel@debian-box.lan> (Richard Shann's message of "Wed, 27 Feb 2013 14:22:51 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) X-Pobox-Relay-ID: 98812828-80EF-11E2-9F27-79910E5B5709-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-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:10148 Archived-At: Hi Richard, On Wed 27 Feb 2013 15:22, Richard Shann writes: > On Wed, 2013-02-27 at 08:19 -0500, mark@markwitmer.com wrote: >> Richard Shann writes: >> >> > (if (not (defined? 'ToggleTripleting::InsideTriplet)) >> > (define ToggleTripleting::InsideTriplet #t)) I'm sorry we were not able to make this case work in Guile 2; it's quite complicated actually. >> You can probably just replace your code with >> >> (define-once ToggleTripleting::InsideTriplet #t) > > Thanks for this - it seems define-once is not defined in guile 1.8 > however You could define it in a prelude somewhere: (cond-expand (guile-2) ; nothing (else ; guile < 2.0 (define-macro (define-once sym exp) `(if (not (defined? ',sym)) (define ,sym ,exp))))) Then you could change all uses of this idiom to use define-once. Note that Guile 2.'s `define-once' is slightly different; it always declares a local definition, and it uses the existing value only if there is already a local definition. In this way imported values get overridden by define-once. Here is a Guile 2-compatible version: (cond-expand (guile-2) ; nothing (else ; guile < 2.0 (define-macro (define-once sym exp) `(define ,sym (if (module-locally-bound? ',sym) ,sym ,val))))) Finally in Guile 2 there is also the `define!' procedure, which makes top-level definitions programmatically. Use it if you need it. But if you can, better to rewrite to use standard Scheme. In general I recommend adding shims to Denemo to make it forward-compatible -- like adding define-once if needed so that it uses the Guile 2.0 idioms, even on 1.8. Good luck, and let us know how it goes. Andy -- http://wingolog.org/