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: Dmitry Gutov
Subject: Re: Why (substring "abc" 0 4) does not return "abc" instead of an error?
Date: Mon, 16 Jul 2012 17:03:33 +0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1

On 16.07.2012 11:32, Bastien wrote:
Dmitry Gutov <address@hidden> writes:

Juanma Barranquero <address@hidden> writes:

On Mon, Jul 16, 2012 at 1:59 AM, Bastien <address@hidden> wrote:

I read (substring "abc" 0 4) as "return the biggest substring
between 0 and 4" -- even if the string does not have 4 characters.

"Even if the string does not have 4 characters" is not even suggested
in substring's doc.

FWIW, it's common behavior in many other programming languages.

Which behavior?  The one I expect?

Yes. For example, JS, Ruby, Python and apparently C++ do.
Scheme, Java and C# don't, but they don't have the "negative index = from the end" behavior either.



reply via email to

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