emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why (substring "abc" 0 4) does not return "abc" instead of an error?


From: Lennart Borgman
Subject: Re: Why (substring "abc" 0 4) does not return "abc" instead of an error?
Date: Mon, 16 Jul 2012 17:07:10 +0200

On Mon, Jul 16, 2012 at 5:00 PM, Pascal J. Bourguignon
<address@hidden> wrote:
> Bastien <address@hidden> writes:
>
>> Hi Pascal,
>>
>> "Pascal J. Bourguignon" <address@hidden> 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.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]