[rust-dev] Swapping elements in a vec

David Herman dherman at mozilla.com
Mon Feb 28 14:38:13 PST 2011

In my experience, trying to give universal definitions for terms like "pure" or "referentially transparent" that cut across multiple programming languages is near impossible to do precisely, and devolves into philosophical "angels and pinheads" territory pretty quickly. Speaking of which, I think this thread has gone a bit far off-topic for the Rust list. Would you guys mind taking it offline from here?


On Feb 28, 2011, at 2:26 PM, austin seipp wrote:

> On Mon, Feb 28, 2011 at 1:09 PM, Florian Weimer <fw at deneb.enyo.de> wrote:
>> * Sebastian Sylvan:
>>> I think that if Haskell allows it, it's unlikely to be an issue even for
>>> purists. :-)
>> Haskell has potential side effects at every pattern match, so it can
>> hardly be used as a reference point for purity.
>> _______________________________________________
>> Rust-dev mailing list
>> Rust-dev at mozilla.org
>> https://mail.mozilla.org/listinfo/rust-dev
> Pattern-match failure resulting in _|_ is hardly a basis to say
> Haskell is 'impure', or dismiss Haskell's purity entirely if you ask
> me. On this basis, is it unreasonable to say all evaluation in Haskell
> has 'potential side effects', because _|_ is an inhabitant of every
> type? It probably isn't unreasonable to say that on such grounds, but
> it's not very useful as an observation either is it? Is a partially
> defined function still not referentially transparent, in that 'f x = f
> x' holds, even if there exists an x such that 'f x' in this case
> results in _|_ (ignoring the fact that all _|_ values are considered
> semantically equivalent)? I do not believe being a 'pure language'
> completely eschews the use of partial functions, but I could be wrong.
> If you wanted to complain, unsafePerformIO would have better deserved
> the pointing finger of disapproval. :) (And it has shown immense
> usefulness many times too I might add, despite being contrary to
> everything we stand for.)
> Partiality, as well as things like non-termination can commonly be
> considered 'effects' (and perhaps are without question considered so
> in the 'total function' view of the world,) but I believe in this case
> it may be grasping at straws a little bit - I stand that by
> Sebastian's assertion that the ST monad is a fine example of strictly
> local mutation hidden by a pure function, and that Rust doing the same
> is likely not going to upset all but those who have the most stringent
> definitions.
> -- 
> Regards,
> Austin
> _______________________________________________
> Rust-dev mailing list
> Rust-dev at mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev

More information about the Rust-dev mailing list