emacs-devel
[Top][All Lists]
Advanced

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

Re: master 0cbcc62: 'assoc' is not side-effect-free; constprop its pure


From: Mattias Engdegård
Subject: Re: master 0cbcc62: 'assoc' is not side-effect-free; constprop its pure subset
Date: Sun, 1 Nov 2020 13:56:50 +0100

1 nov. 2020 kl. 10.47 skrev Andrea Corallo via Emacs development discussions. 
<emacs-devel@gnu.org>:

> just ot mention, would be nice if we design this to be accessible so we
> can use it in the native compiler as well maintaining it just in one
> place.

It wasn't really meant seriously, but a simple system may look like

EFFECT ::=
   nil        ; no effect (subset of all effects)
 | *          ; any effect (superset of all effects)
 | signal     ; signal any condition (error etc)
 | read-env   ; read from the global environment
 | N          ; effect of function passed as argument N, N≥1
 | (union EFFECT...)  ; union of effects

Then today's declarations correspond to the effects:

pure              ~  signal
side-effect-free  ~  (union signal read-env)
error-free        ~  read-env

and the effects of 'assoc' would be (union signal 3).

More fine-grained effects could be added, such as throws, mutation of 
arguments, reading data referenced by arguments, etc.

It all depends on what is useful for the compiler(s) and related tools.




reply via email to

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