From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.devel Subject: Re: Bound index checks in cl-seq functions Date: Fri, 03 Mar 2017 13:47:45 +0900 Message-ID: <87r32f7yq6.fsf_-_@calancha-pc> References: <87efzdrjsj.fsf@calancha-pc> <87inoisd6y.fsf@calancha-pc> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1488516536 26354 195.159.176.226 (3 Mar 2017 04:48:56 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 3 Mar 2017 04:48:56 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: tino.calancha@gmail.com, Emacs developers To: John Wiegley , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 03 05:48:48 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjf90-0005RL-MT for ged-emacs-devel@m.gmane.org; Fri, 03 Mar 2017 05:48:42 +0100 Original-Received: from localhost ([::1]:56114 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjf95-0007nk-1d for ged-emacs-devel@m.gmane.org; Thu, 02 Mar 2017 23:48:47 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58741) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjf8D-0007mP-U6 for emacs-devel@gnu.org; Thu, 02 Mar 2017 23:47:55 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjf8A-00052H-RS for emacs-devel@gnu.org; Thu, 02 Mar 2017 23:47:53 -0500 Original-Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:33283) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cjf8A-000521-M3; Thu, 02 Mar 2017 23:47:50 -0500 Original-Received: by mail-pf0-x244.google.com with SMTP id e66so3081540pfe.0; Thu, 02 Mar 2017 20:47:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Nh9m3yVqZ7qg2ujQGMPNeaULmLFATwTnk5xNwEcZF18=; b=cETuR0g44B6wz4Y5rS7+tF6NV5i13jJaAAjpoCe4IbdUUZ9yAF2FFum5R9lgJDcmB9 8w7ne0Bgqolw1avj5E56snCrK5qqOz68cdwW093hrrDd50QfPCIrC6+Ae4j1yvMjQZCI KDVYnLuzpelF2OjtiV8PGnXrWO8XWIYnMKNSD8bXGY08weo5NICHRBIShtlka4XF67de 7liWsZh/FhYARZprslxS8WLkkVn67ameF7jyFy+vrnAsxX+8ic7FRdSXbyN1ZYiJfntB Qa74OhBClE2F5TsfEAsaFUFVfUxQF5VRgJoqgl062TuGtZTutwdqwc8A2N3d6zt+RoFK 6Zmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=Nh9m3yVqZ7qg2ujQGMPNeaULmLFATwTnk5xNwEcZF18=; b=lxrjMX2Pzb2LaoZDD6lxa2w7anA1Ph5BPM6+b9yAmeQyrXdEIswOy5XMEBbjfBH+lz JVwBV4hXFPuZUs8b8VhH2oopOwrGtANNXGfFrRKUITQ5gjn3OvjHvgRNNpq5dDB4Gwmc 4HkL1Iphl1WL8uTbufQYNQHFa2zhZz6PQuUicb7K5iURErYuzMEinne1pPKF+e1u/X1q oN7UMIjKjcKtXCJn9NFFvR3hqI3NAZkzmtqp8ts2P19BiTe640PaaJ8ljy7UvMb2kuuH 2dizajQpKodVTo8vkYI4GBrOkm7HorUY7DsuoIHOG16diumWcJQTZ2TCM0Ft3hNpw8Pn p7mw== X-Gm-Message-State: AMke39kt497kSWAQKhxd5yxqtOjW5eC8COXDcs/AiKilQ5UvKivO3SbAzIhtsnWqCctt4g== X-Received: by 10.84.128.98 with SMTP id 89mr1462358pla.24.1488516469665; Thu, 02 Mar 2017 20:47:49 -0800 (PST) Original-Received: from calancha-pc (104.81.147.124.dy.bbexcite.jp. [124.147.81.104]) by smtp.gmail.com with ESMTPSA id t22sm20004829pfa.114.2017.03.02.20.47.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Mar 2017 20:47:48 -0800 (PST) In-Reply-To: <87inoisd6y.fsf@calancha-pc> (Tino Calancha's message of "Fri, 10 Feb 2017 16:43:49 +0900") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c00::244 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:212729 Archived-At: Tino Calancha writes: > Tino Calancha 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