emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] emacs-25 3eb93c0: Rely on conservative stack scanning


From: Paul Eggert
Subject: Re: [Emacs-diffs] emacs-25 3eb93c0: Rely on conservative stack scanning to find "emacs_value"s
Date: Wed, 30 Mar 2016 11:42:26 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1

On 03/30/2016 11:26 AM, Philipp Stephani wrote:

    It's not clear that this feature is worth the hassle of supporting it.


If emacs_value* were a real pointer, then the feature would come for free.

This is begging the question, no? There are good reasons to be suspicious of null values, regardless of whether they are represented by null pointers or by something else.

    As Stefan mentioned, one can easily use Qnil etc. as sentinels.


These aren't sentinels because functions can return nil without existing non-locally.

If there is a need for C code to return a value that is either an Emacs value or something else, then a cleaner way to specify this is as some sort of discriminated union that is either an Emacs value, or something else. Attempting to shoehorn an "I'm not an Emacs value!" value into the emacs_value type leads to unnecessary confusion. At least, any such union type should be called "emacs_value_option", or something like that, to clearly warn the maintainer that the type is an Emacs value or is something else.


XCAR etc. certainly can't be avoided. We should try to reduce undefined behavior though, not add more.


Yes, there are good arguments against the XCAR etc. approach that is used throughout the Emacs interpreter. However, there are also good arguments for the approach, and the current Emacs design clearly uses and assumes it and it works well enough in practice to overcome the mostly-theoretical objections raised in this thread. Regardless of the implementation strategy chosen by the Emacs core, it's better if the module system lives in harmony with the Emacs interpreter instead of attempting to fight against it.



reply via email to

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