all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Philipp Stephani <p.stephani2@gmail.com>,
	Daniel Colascione <dancol@dancol.org>,
	emacs-devel@gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
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	[thread overview]
Message-ID: <56FC1E12.3070108@cs.ucla.edu> (raw)
In-Reply-To: <CAArVCkS81--_T12knm0ufeHEy==r5Fx6OuwkC4as6Y=GKitxCA@mail.gmail.com>

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.



  parent reply	other threads:[~2016-03-30 18:42 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20151130193446.22218.14685@vcs.savannah.gnu.org>
     [not found] ` <E1a3UDm-0005my-HI@vcs.savannah.gnu.org>
2016-01-03 13:59   ` [Emacs-diffs] emacs-25 3eb93c0: Rely on conservative stack scanning to find "emacs_value"s Daniel Colascione
2016-01-03 15:45     ` Paul Eggert
2016-03-29 10:07       ` Philipp Stephani
2016-03-29 12:59         ` Stefan Monnier
2016-03-30  1:35         ` Paul Eggert
2016-03-30 18:26           ` Philipp Stephani
2016-03-30 18:28             ` Daniel Colascione
2016-03-30 18:42             ` Paul Eggert [this message]
2016-03-30 18:48               ` Daniel Colascione
2016-03-30 21:13             ` Stefan Monnier
2016-03-30 21:18               ` Daniel Colascione
2016-03-30 21:30                 ` Stefan Monnier
2016-03-31 18:46                   ` Philipp Stephani
2016-03-31 19:24                   ` Daniel Colascione
2016-03-31 21:29                     ` Stefan Monnier
2016-04-01 18:34                       ` Daniel Colascione
2016-04-01 19:05                         ` Stefan Monnier
2016-04-01 19:15                           ` Daniel Colascione
2016-04-01 22:46                             ` Stefan Monnier
2016-04-03  1:11                               ` Daniel Colascione
2016-04-03  5:49                                 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56FC1E12.3070108@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=dancol@dancol.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=p.stephani2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.