From: Mark H Weaver <mhw@netris.org>
To: David Kastrup <dak@gnu.org>
Cc: 17296@debbugs.gnu.org
Subject: bug#17296: Uh, wrong?
Date: Wed, 04 Jun 2014 10:49:04 -0400 [thread overview]
Message-ID: <87sinku3vj.fsf@yeeloong.lan> (raw)
In-Reply-To: <87bnu98ezt.fsf@fencepost.gnu.org> (David Kastrup's message of "Wed, 04 Jun 2014 06:39:50 +0200")
David Kastrup <dak@gnu.org> writes:
> Mark H Weaver <mhw@netris.org> writes:
>
>> David Kastrup <dak@gnu.org> writes:
>>> So the behavior for length+ on a dotted list is strictly unspecified.
>>> It is not even stated "it is an error".
>>
>> Actually, it is. At the end of the section that defines the "types"
>> such a "clist" and "flist", it states:
>>
>> It is an error to pass a circular or dotted list to a procedure not
>> defined to accept such an argument.
>>
>> While it is true that we are not required to signal an error, I'm wary
>> extending 'length+' in this way. It also effectively extends 'map' and
>> 'for-each' to support things like (map + '() 'foo), and thus potentially
>> affects many other procedures both inside and outside of Guile that use
>> 'map' and 'for-each'. Once we've done this, users are likely to grow
>> dependent on it and we can never go back.
>
> That is true for _any_ particular choice for unspecified behavior.
> _Including_ throwing an error as a means of checking input validity.
>
> You are proposing providing functions _not_ defined in srfi-1 at all for
> functionality that is clearly desirable even for implementing behavior
> required by some functions in srfi-1.
If we want things like (map + - * /) to signal an error, then we need a
'length+' that signals an error when passed - or * or /. In fact,
that's precisely what motivated me to make 'length+' more strict.
So, you and I are coming at this from different angles. I want a strict
'length+' to implement 'map' and 'for-each', and you want a lax one to
implement 'drop-right' et al. It seems to me that we need both.
The fact that the SRFI-1 reference implementation of 'length+' is lax
very nearly swayed me over to your position, but there's a problem:
Guile's 'length+' has (always?) returned #f for dotted lists. It would
be dangerous to silently change the behavior of this case from one
non-error to another non-error. Programs could start silently
misbehaving without any clue that anything went wrong.
Mark
next prev parent reply other threads:[~2014-06-04 14:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-18 19:26 bug#17296: [PATCH] SRFI-1 'length+' raises an error unless passed a proper or circular list Mark H Weaver
2014-06-02 0:56 ` Mark H Weaver
2014-06-03 17:30 ` bug#17296: Uh, wrong? David Kastrup
2014-06-04 2:55 ` Mark H Weaver
2014-06-04 4:39 ` David Kastrup
2014-06-04 14:49 ` Mark H Weaver [this message]
2014-09-22 17:34 ` Mark H Weaver
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=87sinku3vj.fsf@yeeloong.lan \
--to=mhw@netris.org \
--cc=17296@debbugs.gnu.org \
--cc=dak@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).