From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.devel Subject: Re: Why (substring "abc" 0 4) does not return "abc" instead of an error? Date: Mon, 16 Jul 2012 17:07:10 +0200 Message-ID: References: <50038E42.1030508@yandex.ru> <87liij3l8f.fsf@kuiper.lan.informatimago.com> <87r4sbeplm.fsf@altern.org> <87hat73g4l.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: dough.gmane.org 1342451276 16225 80.91.229.3 (16 Jul 2012 15:07:56 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 16 Jul 2012 15:07:56 +0000 (UTC) Cc: emacs-devel@gnu.org To: "Pascal J. Bourguignon" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 16 17:07:56 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Sqmtv-0001S6-K6 for ged-emacs-devel@m.gmane.org; Mon, 16 Jul 2012 17:07:55 +0200 Original-Received: from localhost ([::1]:32999 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sqmtu-0005fO-R1 for ged-emacs-devel@m.gmane.org; Mon, 16 Jul 2012 11:07:54 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:52528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sqmtn-0005bd-QR for emacs-devel@gnu.org; Mon, 16 Jul 2012 11:07:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sqmti-0000CA-U4 for emacs-devel@gnu.org; Mon, 16 Jul 2012 11:07:47 -0400 Original-Received: from mail-lb0-f169.google.com ([209.85.217.169]:34471) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sqmti-0000C1-Ml for emacs-devel@gnu.org; Mon, 16 Jul 2012 11:07:42 -0400 Original-Received: by lbjn8 with SMTP id n8so9052751lbj.0 for ; Mon, 16 Jul 2012 08:07:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=3ROXbMTpvDrNHq0wYjZUG+jIeeYgW2t8Kp7B0o7J0XY=; b=S1x14/zhWxw2lqWQ1mdrBXEvnOxs07GHZ9K11POcggUtfYdHF94VIk5ixCF7/ymFGc F2ClmX2tGcrWeZCTIH2iKpS+3ZogmSr7Zmya80JscywjSvdlUM0rUNrRDGMeeWCDUdPT Wm0l+RTjuyEA/tbVK13KJch9vMUzgdT+j7RlsQu3gnbuwo65WxSJgIPwuz54zW00B8Q5 N0Xb5BTHmnq+260H3Eu0TobH5SR9ms8U/5PjyZsgu5IgxSSQ+OQMAdVe0gkMGAetOU5b bbt8M3Oawqr8JMUfNF6pLUt0l8ZZskV6J3cf9Br5sZM3DGT+p5+d7QOy6apg8zS+zpua b1ZQ== Original-Received: by 10.112.102.136 with SMTP id fo8mr5620583lbb.106.1342451260924; Mon, 16 Jul 2012 08:07:40 -0700 (PDT) Original-Received: by 10.112.41.99 with HTTP; Mon, 16 Jul 2012 08:07:10 -0700 (PDT) In-Reply-To: <87hat73g4l.fsf@kuiper.lan.informatimago.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.217.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:151669 Archived-At: On Mon, Jul 16, 2012 at 5:00 PM, Pascal J. Bourguignon wrote: > Bastien writes: > >> Hi Pascal, >> >> "Pascal J. Bourguignon" writes: >> >>> (defun mysubstring (str start end) >>> (substring str (max start 0) >>> (if end >>> (min end (length str)) >>> (length str)))) >>> >>> and use (mysubstring "abc" 0 4) --> "abc" >>> instead of substring. ... > Technically, one good reason to signal an error instead of silently > clipping the arguments is that exactly it detects an error. Since lisp It is a good reason not to change the old behaviour. However introducing a new function in Emacs like the one you suggest would save time for all those who need this function. (It is hard for me even to come up with an example where I do not want this instead of the old one.)