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: when and unless Date: Tue, 06 Dec 2011 18:35:16 +0100 Message-ID: <8739cxob6z.fsf@pobox.com> References: <878vsjd2fh.fsf@pobox.com> <87r50ircng.fsf@pobox.com> <4EDDC8B1.3000509@gentoo.org> <87mxb6kkzx.fsf@fencepost.gnu.org> <877h29oeeq.fsf@pobox.com> <877h29k5xs.fsf@fencepost.gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1323192937 26498 80.91.229.12 (6 Dec 2011 17:35:37 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 6 Dec 2011 17:35:37 +0000 (UTC) Cc: guile-devel@gnu.org To: David Kastrup Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Dec 06 18:35:33 2011 Return-path: Envelope-to: guile-devel@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 1RXyvU-00051H-Fo for guile-devel@m.gmane.org; Tue, 06 Dec 2011 18:35:32 +0100 Original-Received: from localhost ([::1]:54472 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXyvT-0003m7-RC for guile-devel@m.gmane.org; Tue, 06 Dec 2011 12:35:31 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:58057) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXyvN-0003j5-Fd for guile-devel@gnu.org; Tue, 06 Dec 2011 12:35:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RXyvM-0004Cg-5g for guile-devel@gnu.org; Tue, 06 Dec 2011 12:35:25 -0500 Original-Received: from a-pb-sasl-sd.pobox.com ([74.115.168.62]:43504 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXyvJ-0004Bc-Kt; Tue, 06 Dec 2011 12:35:21 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 14067801D; Tue, 6 Dec 2011 12:35:21 -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=pkEWQr+UppHB8ass/GsdN6Xk/c8=; b=hme5Iq b7TkT3t6I/oa1k90WOcvKv3U5r96ycu1heUcsuEft+NkxDo0LMLUQ2xgkJ+jDpDo uZwMyMmQuJDUxSkecx49lWaUsRFgJkFLhV8F5Jl552L57K/prO2Hhas7fGlLWk7B c6b6DLgtejwx6kwZsuGJFS8riDL59ParGcY5o= 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=Nxz/bcak8GKhfIbd378YLgIZ0qTl6phE 9VkVhtXWUfMBADYZZqPkd69AyINZ2d2jjQAcym9p1dmlAMc3SNmjL8IM5tgKXVlY SsMDv0hx4Je5dd4x1nCLHFAXKDdDqxOrRmhUjMmX5FdbWtmHew3Dd23iIJAzSs4f eEB4OEGP4D4= Original-Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 0D050801C; Tue, 6 Dec 2011 12:35:21 -0500 (EST) Original-Received: from badger (unknown [90.164.198.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id 4F71D801A; Tue, 6 Dec 2011 12:35:20 -0500 (EST) In-Reply-To: <877h29k5xs.fsf@fencepost.gnu.org> (David Kastrup's message of "Tue, 06 Dec 2011 17:42:23 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-Pobox-Relay-ID: AB71FDDE-2030-11E1-A5BA-65B1DE995924-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 74.115.168.62 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:12992 Archived-At: On Tue 06 Dec 2011 17:42, David Kastrup writes: > Andy Wingo writes: > >> On Tue 06 Dec 2011 12:17, David Kastrup writes: >> >>> I've actually wondered if it would not make sense to return >>> *unspecified* in the case of the plain else-less if even if the >>> condition is true, namely when you write (if #t #t). >> >> A first (and probably worthwhile) step would be to warn if such >> a statement is processed for value. > > Well, is it being processed for value if what I do with the value is > calling unspecified? on it in order to find out whether I should warn > about a function returning a value when it shouldn't? Yes, it would be. Note, in R5RS scheme, this should be true: (eqv? (if #f #f) (if #f #f)) In R6RS (and R7RS, I think) scheme it does not have any meaning -- implementations are free to do what they like. The reason is that (if #f #f) returns "unspecified values" rather than a canonical "unspecified value". So the implementation may treat it like: (eqv? (values) (values)) which is strictly unspecified, as it is returning an unexpected number of values to a continuation. Guile 1.8: guile> (eqv? (values) (values)) #f Guile 2.0: scheme@(guile-user)> (eqv? (values) (values)) ERROR: In procedure values: ERROR: Throw to key `vm-error' with args `(vm-run "Zero values returned to single-valued continuation" ())'. Not a nicely printed error, but oh well. Guile 2.0 returns a canonical unspecified value in this situation. I would like to consider returning 0 values instead in the future, but figuring out how to do so without breaking the world is tricky. It's useful to hear about your experiences with *unspecified*. > I am working on a language where returning values in certain contexts > might at one point of time might lead to the values being used. So I > need to implement warnings to that effect in order to find out calls > _not_ returning *unspecified*... Have you considered using `(values)' as your way of saying, "I'm not returning any values"? Andy -- http://wingolog.org/