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

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

Re: (interactive) and &optional


From: Philip Kaludercic
Subject: Re: (interactive) and &optional
Date: Sat, 25 Mar 2023 13:12:48 +0000

Dr Rainer Woitok <rainer.woitok@gmail.com> writes:

> Philip,
>
> On Thursday, 2023-03-23 19:20:29 +0000, you wrote:
>
>> ...
>> > as expected,  while calling "M-x fun" and then just typing  "RET" at the
>> > prompt returns
>> >
>> >   val:.\n
>> >
>> > that is, an empty symbol or string.
>> 
>> Right.
>
> That's a bit flabbergasting: experimenting some more with my function, I
> found that "symbolp" really returns t in case of empty responses,  mean-
> ing there really is such a thing as an empty symbol.   So how can I test
> for an empty symbol?  

I am guessing it is not an "empty symbol" (to my knowledge the term is
not defined), but rather the fact that `nil' is a symbol.  Depending on
what you did, it might also be that you are interning the empty string,
which creates a symbol with an empty string as the symbol name -- which
is not unique. 

>                       There doesn't seem to be a function "symbol-empty-
> p" while, strictly speaking,  "string-empty-p" shouldn't be applyable to
> symbols at all, should it?  

No, trivially because a symbols is not a string, and shouldn't be
regarded as similar data types.  Depending on the context, it might be
totally justified to regard the symbol name of a symbol as totally
incidental.

>                             Does an empty symbol have an external repre-
> sentation like an empty list or string, allowing the use of "eq"?

A symbol is eq to all other symbols that were either created by passing
the same (equal) string to `intern' or by the same invocation of
`make-symbol'.  That could be useful if you are trying to handle a
symbol that as an empty string as the symbol name -- but at that point I
think it would be better to just check the string before it is interned.

> Sincerely,
>   Rainer

-- 
Philip Kaludercic



reply via email to

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