Purity in Java & D

2010-09-05 Thread bearophile
A paper I've recently read: "Verifiable Functional Purity in Java", by Matthew Finifter, Adrian Mettler, Naveen Sastry and David Wagner: http://www.cs.berkeley.edu/~finifter/pure-ccs08.pdf At page 12 it says some things about D2 too (this article is not updated to the last changes in D2): In a

Re: Purity in Java & D

2010-09-05 Thread Simen kjaeraas
bearophile wrote: class or instance immutability is necessary to ensure determinism in a concurrent program, as otherwise a mutable alias can be used to concurrently modify the object. That's the price of being a systems language - it is possible to subvert the type system. However, we also h

Re: Purity in Java & D

2010-09-05 Thread bearophile
Simen kjaeraas: > So it is basically exactly like D, only no mutable global state? It's similar, of couse. I think there is no 'pure' tag, the compiler infers if a method is pure on the base of its arguments. In D even a function that is technically pure is not seen as pure of you don't tag it w

Re: Purity in Java & D

2010-09-05 Thread Jonathan M Davis
On Sunday 05 September 2010 16:59:19 bearophile wrote: > Simen kjaeraas: > > So it is basically exactly like D, only no mutable global state? > > It's similar, of couse. I think there is no 'pure' tag, the compiler infers > if a method is pure on the base of its arguments. In D even a function > t

Re: Purity in Java & D

2010-09-05 Thread Walter Bright
Jonathan M Davis wrote: Having the compiler determine purity would be cool, but it runs into a few of problems. The most serious one I can think of is: Suppose you are depending on a function being pure. If the compiler determines its purity, it *does not tell you* if it is impure. Your code

Re: Purity in Java & D

2010-09-05 Thread Simen kjaeraas
Walter Bright wrote: Jonathan M Davis wrote: Having the compiler determine purity would be cool, but it runs into a few of problems. The most serious one I can think of is: Suppose you are depending on a function being pure. If the compiler determines its purity, it *does not tell you* i

Re: Purity in Java & D

2010-09-05 Thread bearophile
Walter Bright: > The most serious one I can think of is: Just to be sure: in my original post of this thread I have not asked to change D. I was just showing a paper. Bye, bearophile