unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: David Kastrup <dak@gnu.org>
To: 17049@debbugs.gnu.org
Subject: bug#17049: Further change ideas.
Date: Sun, 30 Mar 2014 18:36:20 +0200	[thread overview]
Message-ID: <87ppl3mynv.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <1395314582-22733-1-git-send-email-dak@gnu.org>


While it does not appear like this patch proposal is going anywhere for
some reason, there is a further opportunity for change.

One thing is to note that scm_srfi1_append_reverse_x does essentially
the same thing but has a different doc string, the second argument
non-optional and a different implementation that creates nonsense on
some arguments and hangs on others:

scheme@(guile-user)> (use-modules (srfi srfi-1))
scheme@(guile-user)> (append-reverse! (circular-list 1 2) '(3 4))
$2 = (4 3 1 2 . #-1#)
scheme@(guile-user)> (append-reverse! (circular-list 1) (circular-list 2))
[hangs uninterruptibly...]

It can also show somewhat inventive error messages:

scheme@(guile-user)> (append-reverse! '(1 2 3 . 4) 5)
ERROR: In procedure append-reverse!:
ERROR: In procedure append-reverse!: Wrong type argument in position 1 (expecting list): 4

or even
scheme@(guile-user)> (append-reverse! (circular-list 1 2 3) 5)
ERROR: In procedure append-reverse!:
ERROR: In procedure append-reverse!: Wrong type argument in position 1 (expecting list): 5


It is an obvious candidate to rerouting to reverse!.  However, there is
another difference apart from append-reverse! not really being all too
robust against errors:

scheme@(guile-user) [2]> (reverse! (circular-list 1 2 3) 5)
ERROR: In procedure reverse!:
ERROR: In procedure reverse!: Wrong type argument in position 1: (1 2 3 . #-2#)

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.

Note that with reverse! the "(expecting list)" in the error message is
absent because scm_wrong_type_arg instead of scm_wrong_type_arg_msg is
employed in scm_reverse_x (directly after the patch, indirectly through
SCM_VALIDATE_LIST before the patch).

So if one wants to have identical error behavior, it would likely make
sense to move to the somewhat more specific scm_wrong_type_arg_msg,
possibly even for the whole of SCM_VALIDATE_LIST.

Of course all this is water under the drawbridge if not even the
original patch is going anywhere.

-- 
David Kastrup





      parent reply	other threads:[~2014-03-30 16:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-20 11:23 bug#17049: [PATCH] Make reverse! forego the cost of SCM_VALIDATE_LIST David Kastrup
2014-03-20 11:38 ` bug#17049: PostScriptum: David Kastrup
2014-03-20 14:19 ` bug#17049: [PATCH] Make reverse! forego the cost of SCM_VALIDATE_LIST David Kastrup
2014-03-20 20:50 ` Andy Wingo
2014-03-20 21:27   ` David Kastrup
2014-03-21  4:38   ` Mark H Weaver
2014-03-21 16:56     ` David Kastrup
2014-03-31 19:56       ` Mark H Weaver
2014-04-01 10:26         ` bug#17049: [PATCH v2] " David Kastrup
2014-04-01 10:40           ` David Kastrup
2014-04-01 14:09             ` Mark H Weaver
2014-04-01 14:24               ` bug#17049: [PATCH v3] " David Kastrup
2014-04-01 16:35                 ` Mark H Weaver
2014-03-21 17:44   ` bug#17049: [PATCH] " David Kastrup
2014-03-30 16:36 ` David Kastrup [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ppl3mynv.fsf@fencepost.gnu.org \
    --to=dak@gnu.org \
    --cc=17049@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).