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: Bastien
Subject: Re: Why (substring "abc" 0 4) does not return "abc" instead of an error?
Date: Mon, 16 Jul 2012 18:13:01 +0200
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1.50 (gnu/linux)

"Pascal J. Bourguignon" <address@hidden> writes:

> It's not a quarrel, it's just to situate your mindset: you've learned
> first another language and you come in emacs lisp with that other
> language mindset.  

Elisp is the first language I learned.

>> I'm not interested in doing crazy stuff, I'm interested in
>>
>> (substring "abc" 0 4 t)
>>   => "abc"
>>
>> where `t' is the value of an option third NOERROR argument.
>>
>> (substring "abc" 0 4) would still throw an error, so that
>> the change does not break any code.
>
> I would not advise that nonetheless.  It can bite you.  I tried things
> like that, and it bit me.  Better use a different name.

Why?

> With the current tools, you cannot easily use a different symbol named
> substring in emacs lisp, and you cannot easily and safely redefine the
> symbol substring, because other functions use it and may depend on its
> current behavior.  It's better to just use a different symbol bound to
> your own function in your own code.

Or to wait for the maintainers to agree with me :)

-- 
 Bastien



reply via email to

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