From: Tino Calancha <tino.calancha@gmail.com>
To: John Wiegley <jwiegley@gmail.com>, Eli Zaretskii <eliz@gnu.org>
Cc: tino.calancha@gmail.com, Emacs developers <emacs-devel@gnu.org>
Subject: Re: Bound index checks in cl-seq functions
Date: Fri, 03 Mar 2017 13:47:45 +0900 [thread overview]
Message-ID: <87r32f7yq6.fsf_-_@calancha-pc> (raw)
In-Reply-To: <87inoisd6y.fsf@calancha-pc> (Tino Calancha's message of "Fri, 10 Feb 2017 16:43:49 +0900")
Tino Calancha <tino.calancha@gmail.com> writes:
> Tino Calancha <tino.calancha@gmail.com> writes:
>
>> Consider following evaluations:
>>
>> (cl-position 2 (list 1 2 3) :start -999)
>> => -998
>> (cl-position 2 (list 1 2 3) :start 999)
>> => nil
>> (cl-position 2 (list 1 2 3) :start 1 :end 0)
>> => nil
>>
>> *) In the first two, the indices are out of range.
>> *) In the 3rd, the start index is higher than the end index.
>>
>> Guy L. Steele recommends to throw an error in those cases:
>> http://www.lispworks.com/documentation/HyperSpec/Issues/iss332_w.htm
>>
>> We have partially done the job, at least for `cl-subseq':
>> (cl-subseq (list 1 2 3) 999)
>> ; Signal: "Bad bounding indices: 999, nil"
>>
>> (cl-subseq (list 1 2 3) -999)
>> ; Signal: "Bad bounding indices: -999, nil"
>>
>> (cl-subseq (list 1 2 3) -1)
>> => (3) ; This is OK as documented in the docstring.
>>
>> See:
>> https://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00182.html
>>
>> It would be nice if all the sequence functions in cl-seq.el
>> throw errors in those situations.
> Dear maintainers,
>
> do you agree with pushing to master the patch v4 for this thread ?
> Here:
> https://lists.gnu.org/archive/html/emacs-devel/2017-02/msg00191.html
>
> Any further suggestion/comment or something to address?
Dear John and Eli,
i am curious if you have any opinion on this thread. Currently just
`cl-subseq' performs the bounding check index. I don't see a
clear reason why just this function do it.
Are you in favour or against doing those checks in other functions
handling sequences?
Regards,
Tino
next prev parent reply other threads:[~2017-03-03 4:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-04 16:40 [PATCH] Bound index checks in cl-seq functions Tino Calancha
2017-02-04 20:42 ` Philipp Stephani
2017-02-04 20:51 ` Noam Postavsky
2017-02-05 7:11 ` [PATCH v2] " Tino Calancha
2017-02-05 14:56 ` [PATCH v3] " Tino Calancha
2017-02-05 16:11 ` [PATCH v2] " Clément Pit-Claudel
2017-02-06 7:00 ` [PATCH v4] " Tino Calancha
2017-02-06 7:15 ` Clément Pit-Claudel
2017-02-10 7:43 ` Tino Calancha
2017-03-03 4:47 ` Tino Calancha [this message]
2017-03-03 13:52 ` Eli Zaretskii
2017-04-14 22:01 ` John Wiegley
2017-04-25 11:14 ` Tino Calancha
2017-02-12 21:26 ` [PATCH] " Johan Bockgård
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/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r32f7yq6.fsf_-_@calancha-pc \
--to=tino.calancha@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=jwiegley@gmail.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).