help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Elisp string function question


From: Eli Zaretskii
Subject: Re: Elisp string function question
Date: Fri, 18 Jun 2021 17:23:56 +0300

> From: Robert Pluim <rpluim@gmail.com>
> Cc: help-gnu-emacs@gnu.org
> Date: Fri, 18 Jun 2021 16:02:07 +0200
> 
>     >> Then itʼs buggy:
>     >> 
>     >> (let ((s (make-symbol "")))
>     >> (string-empty-p s))
>     >> => t
> 
>     Eli> Is it?  What is the name of the symbol created there?
> 
> The name is "", but the symbol itself has no value, so string-empty-p
> should not say t

But if the documentation will say that string-empty-p accepts symbols
and uses their name, then the name of this symbol _is_ empty.

> (let ((s (make-symbol "")))
>   (message s))
> =>
> Debugger entered--Lisp error: (wrong-type-argument stringp ##)
>   message(##)
>   (let ((s (make-symbol ""))) (message s))
>   (progn (let ((s (make-symbol ""))) (message s)))
>   eval((progn (let ((s (make-symbol ""))) (message s))) t)
> 
> Compare this with:
> 
> (let ((s ""))
>   (string-empty-p s) => t
>   (message "string '%s'" s)) => no complaints from 'message'

This is because 'message' does NOT allow symbols as its first
argument.



reply via email to

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