From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Marius Vollmer Newsgroups: gmane.lisp.guile.devel Subject: Re: GH replacement proposal (includes a bit of Unicode) Date: Tue, 10 Aug 2004 00:28:21 +0200 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <87n014vtdm.fsf@zagadka.ping.de> References: <40812F4B.3080700@dirk-herrmanns-seiten.de> <873c65be76.fsf@zagadka.ping.de> <40A5EE69.8020200@dirk-herrmanns-seiten.de> <87ekp962jc.fsf@zagadka.ping.de> <40B51619.3010505@dirk-herrmanns-seiten.de> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1092090550 25813 80.91.224.253 (9 Aug 2004 22:29:10 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 9 Aug 2004 22:29:10 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Aug 10 00:29:02 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BuIda-0003dh-00 for ; Tue, 10 Aug 2004 00:29:02 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BuIhL-0002tQ-SG for guile-devel@m.gmane.org; Mon, 09 Aug 2004 18:32:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BuIhG-0002pK-1l for guile-devel@gnu.org; Mon, 09 Aug 2004 18:32:50 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BuIhD-0002nj-3j for guile-devel@gnu.org; Mon, 09 Aug 2004 18:32:48 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BuIhC-0002m6-Ec for guile-devel@gnu.org; Mon, 09 Aug 2004 18:32:46 -0400 Original-Received: from [195.253.8.218] (helo=mail.dokom.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BuId1-0003O9-Rg for guile-devel@gnu.org; Mon, 09 Aug 2004 18:28:28 -0400 Original-Received: from [195.138.45.200] (helo=zagadka.ping.de) by mail.dokom.net with smtp (Exim 4.34) id 1BuIcz-0007UA-H6 for guile-devel@gnu.org; Tue, 10 Aug 2004 00:28:26 +0200 Original-Received: (qmail 6882 invoked by uid 1000); 9 Aug 2004 22:28:21 -0000 Original-To: Dirk Herrmann In-Reply-To: <40B51619.3010505@dirk-herrmanns-seiten.de> (Dirk Herrmann's message of "Thu, 27 May 2004 00:11:37 +0200") User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) 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: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:3927 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:3927 Dirk Herrmann writes: > No misunderstanding. I fully agree with you that the code should never > silently work with incorrect values. However, if scm_to_int throws an > error 'wrong type argument' or 'argument out of range', this is still not > too much of a help in many cases. Yes. For more help, people probably need to use the debugger, or a backtrace, or maybe need to instrument their code. >> I see the typical use of scm_to_int etc to be in glue code, like >> >> SCM posix_kill (SCM pid, SCM sig) { return scm_from_int (kill >> (scm_to_int (pid), scm_to_int (sig))); } >> >> That is all it should take to wrap 'kill'. > > And it is already an example that 'argument out of range' is not a > very good message if the return value is out of range. The return value can not be out of range since a SCM can represent all values that fot into an 'int'. (I know that you know that ;-) > But, this can certainly easily be fixed by changing the error > message to 'value out of range'. Yes, not using "argument" in the error message is likely an improvement. Not all values that are wrong are thought of directly as arguments by the user. For example, the wrong value might be an element of a list that is an argument. > Still, I am wondering whether a user of this function would not be > happier if instead of 'argument out of range' or 'value out of range' > the message would be one of > 'process id argument to kill out of range' > 'signal argument to kill out of range' Yes, that would be very good. Right now, we only give argument positions, and that as good as argument names. With scm_to_int, we the argument positions are not included in the error message, which is a clear drawback. Right now, I hope that the debugger and the backtrace mechanism can be used to recover this lost information. In addition to giving a backtrace that shows how the flow of control has reached the point of error, it can also show how the erroneous value has reached this point. That is, the backtrace would highlight occurences of the wrong value in the printed backtrace. (The obvious problem is that immediate values can not be reliably found, but hopefully this is not a big problem if we are careful to acknowledge this uncertainty in the output, i.e, when we state that "the wrong value might be the second or third argument", say, for immediates, instead of saying "it is the second one".) I'll say more when I have toyed more with this idea. > On what basis would the decision be taken? By asking people > on the guile-devel and guile-user lists what they would prefer? *cough*, I just did it my way! The code is now in CVS head, comments welcome! -- GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405 _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel