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: [PATCH v4] Bound index checks in cl-seq functions Date: Fri, 10 Feb 2017 16:43:49 +0900 Message-ID: <87inoisd6y.fsf@calancha-pc> References: <87efzdrjsj.fsf@calancha-pc> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1486712680 2893 195.159.176.226 (10 Feb 2017 07:44:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 10 Feb 2017 07:44:40 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: Noam Postavsky , Philipp Stephani , tino.calancha@gmail.com, =?utf-8?Q?Cl=C3=A9ment?= Pit-Claudel , Emacs developers To: John Wiegley , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 10 08:44:35 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 1cc5sf-0000PS-W8 for ged-emacs-devel@m.gmane.org; Fri, 10 Feb 2017 08:44:34 +0100 Original-Received: from localhost ([::1]:42372 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cc5sl-00030w-Nx for ged-emacs-devel@m.gmane.org; Fri, 10 Feb 2017 02:44:39 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35108) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cc5s7-0002vu-MF for emacs-devel@gnu.org; Fri, 10 Feb 2017 02:44:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cc5s4-00059V-Jo for emacs-devel@gnu.org; Fri, 10 Feb 2017 02:43:59 -0500 Original-Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:33929) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cc5s4-00059P-EC; Fri, 10 Feb 2017 02:43:56 -0500 Original-Received: by mail-pf0-x242.google.com with SMTP id o64so1052522pfb.1; Thu, 09 Feb 2017 23:43:56 -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=lvhKdG0cm/nLEpadTYbRYyu2LDrfdBmzpEnEOR/MHx0=; b=LtaBDRxWNgYZz1PYXso12/PR46ZrvZDDArrAxecDfReahMJNLmC+PeHFtnSteC/g/i zRAzlJZ5Sfy1Zvpj810d4LdU2RGHP+LKlrxrLKeLMprkT/kbUMELsIADXX6CbnmADyOl kwWHXNe+VIEKtMxm18BRr42nhP5WbR4Wt2kdZVLufh39MnxPTFVegDznifXtBHmQHlAl QfU4q5ECVHA5zozBQLjtLiA0aUNfW+ryGaeFCqdgINUHNuATHxYzL66ZtqhuBETVOWMz xUWkRC31T4NswYYi1BoDRYgncQcd8x2jRDrPSt9g4V11N0TvTWHCO7SiLa+A7v25vDtt ayaw== 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=lvhKdG0cm/nLEpadTYbRYyu2LDrfdBmzpEnEOR/MHx0=; b=XgptzGZ+p1sH1MDjW0w0+ivYKLzt2gfrk2GvyOHwhKWiGx+l357Iv7xwGfGJKGHJF1 aAdm64JkxuFFr4Oeqp2neo7wwjxLE+VPwJlhE89cJ8UA+A9Wcu+Ot+FB5h2W9YqtMwBV LpsWfcu2xw9EKN/ZmyqRUOOaDx4ueAVu+3aEXIdNQw/lh27QaSEmywv9+71VzpSYl9mc uUOBkkBpp0VUn0WshTFwiF+M817cQx2urp5zvqq0DjzPf3CY+u3+pUqDzf9V3VM5YI3A DLUvy1eS0AA4+6vXk6sfuVRhNOVEVLV6y3xwafmreRjo8NklRUV31rq8IlPM2yUsCdAq Bp3A== X-Gm-Message-State: AMke39koVvUY8X8i1C9JUHcBiT3NBQCLVhF7AkCJbFolPu5g2k4cCGdJgcub7UOM8GhqcA== X-Received: by 10.84.175.195 with SMTP id t61mr9594565plb.59.1486712635504; Thu, 09 Feb 2017 23:43:55 -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 z70sm2706669pff.26.2017.02.09.23.43.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Feb 2017 23:43:55 -0800 (PST) In-Reply-To: <87efzdrjsj.fsf@calancha-pc> (Tino Calancha's message of "Sun, 05 Feb 2017 01:40:44 +0900") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c00::242 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:212202 Archived-At: 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? Thanks, Tino