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

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

Re: What does the coding system nil mean?


From: Jesper Harder
Subject: Re: What does the coding system nil mean?
Date: Mon, 26 Jan 2004 16:20:22 +0100
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

Eli Zaretskii <eliz@elta.co.il> writes:

>> Then nil isn't really a coding system, but just a value that some
>> coding system related functions happen to interpret in a certain way.
>
> It's a coding system in the sense that every primitive that accepts
> a coding system symbol also accepts nil.

But it's not transparent, i.e. some functions behave differently if
you use nil rather than a real coding system.  For example

    (progn
      (setq last-coding-system-used 'none-such)
      (encode-coding-string "foo" nil)
      last-coding-system-used)

    => none-such

If nil was a real coding system, the value of
`last-coding-system-used' would have been changed.  There are also
other cases, where you can tell that nil is not a coding system.

>> Though, I think it's a bit odd for a predicate called
>> `coding-system-p' to return t for an object that is _not_ in fact a
>> coding system.
>
> IMHO, it's no more odd than this:
>
>    M-: (listp nil) RET => t

I would find it a lot more odd if (listp ()) did not return t -- nil
is the empty list, after all.


reply via email to

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