[Top][All Lists]

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

Re: pure-fns in byte-opt.el

From: Stefan Monnier
Subject: Re: pure-fns in byte-opt.el
Date: Wed, 26 Jul 2017 08:58:24 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

> I see.  That's not what I understood to be usually meant by "pure":
> although both arguments are pointers to the same address in memory,
> the contents of that address have been modified in the meantime.
> In that sense, haven't the two calls to string-to-char been passed
> different values (albeit stored in the same memory location)?

If you think of Haskell types:

    string-to-char :: String -> IO Char

and that's because in order to implement string-to-char, you need to use

    aref :: Array α -> Int -> IO α

> In other words, I don't see your example as proving that
> string-to-char is impure; instead, it just looks like a pure function
> that's passed two different values.  As a concrete example, is the
> following a proof that string-to-syntax is impure? If so, it should be
> removed from our list of pure functions :)

There are different notions of purity, indeed.  Which is why I replied
to Andreas saying that just because string-to-char is not strictly
speaking pure, I don't see why adding it to pure-fns would
break anything.


reply via email to

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