emacs-devel
[Top][All Lists]
Advanced

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

Re: Elisp / C inconsistency for reading "1."


From: Wolfgang Jenkner
Subject: Re: Elisp / C inconsistency for reading "1."
Date: Sat, 15 Mar 2014 17:21:26 +0100
User-agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/24.3.50 (berkeley-unix)

On Fri, Mar 14 2014, Stefan wrote:

>> More important, it feels wrong coming from a Lisp background, as Common Lisp
>> and Scheme both interpret "1." to be a floating point number.  I would
>> support changing Emacs Lisp to be consistent with common practice, as there
>> seems no point to being different and there are advantages to being
>> consistent.  (Not during the feature freeze though, of course.)
>
> I'd tend to agree, indeed.

But please don't base your opinion on a wrong assumption about Common
Lisp, see [1],

        Integers can be written as a sequence of digits [...]
        optionally followed by a decimal point;
        
And, to be really pedantic, let's add that `integer' and `float' are
disjoint types, see [2],

        The types rational and float are disjoint subtypes of type real.

and [3],

        The types integer and ratio are disjoint subtypes of type
        rational.
        
This remark is actually pertinent here, because the emacs CL package
seems to emulate these type relations (as far as corresponding objects
exist in emacs-lisp).

(cl-typep 1. 'integer)
=> t
(cl-typep 1. 'float)
=> nil

[1] http://www.lispworks.com/documentation/HyperSpec/Body/02_cbaa.htm
[2] http://www.lispworks.com/documentation/HyperSpec/Body/t_real.htm
[3] http://www.lispworks.com/documentation/HyperSpec/Body/t_ration.htm

Wolfgang



reply via email to

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