Re: Should GC.malloc be considered 'pure'?

2011-06-12 Thread KennyTM~
On Jun 10, 11 01:51, KennyTM~ wrote: Given that the 'new' expression can be used in 'pure', should it be that GC allocation functions like GC.malloc, GC.qalloc and GC.extend (?) be weakly pure also? And should it apply to other managed allocators as well, e.g. the proposed TempAlloc? I'm asking

Re: Should GC.malloc be considered 'pure'?

2011-06-11 Thread Robert Jacques
On Sat, 11 Jun 2011 14:59:55 -0400, pillsy wrote: == Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article On Thu, 09 Jun 2011 13:51:31 -0400, KennyTM~ wrote: > Given that the 'new' expression can be used in 'pure', should it be that > GC allocation functions like GC.malloc, GC.q

Re: Should GC.malloc be considered 'pure'?

2011-06-11 Thread pillsy
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article > On Thu, 09 Jun 2011 13:51:31 -0400, KennyTM~ wrote: > > Given that the 'new' expression can be used in 'pure', should it be that > > GC allocation functions like GC.malloc, GC.qalloc and GC.extend (?) be > > weakly pure also? >

Re: Should GC.malloc be considered 'pure'?

2011-06-11 Thread bearophile
Kagamin: > Won't this pollute everything with @trasparent annotations, because code > usually doesn't depend on pointer value so it would want to work on > transparent pointers. Probably some compromise is better, that allows you to drop this annotation in most situations where it's not necess

Re: Should GC.malloc be considered 'pure'?

2011-06-09 Thread Kagamin
bearophile Wrote: > Did you miss the discussion I've had here about the @trasparent? The > allocation of heap memory can be considered pure if you use the allocated > memory as a referentially transparent value (this means it's allowed to be > used by reference, but your code is not allowed to

Re: Should GC.malloc be considered 'pure'?

2011-06-09 Thread Robert Jacques
On Thu, 09 Jun 2011 13:51:31 -0400, KennyTM~ wrote: Given that the 'new' expression can be used in 'pure', should it be that GC allocation functions like GC.malloc, GC.qalloc and GC.extend (?) be weakly pure also? And should it apply to other managed allocators as well, e.g. the proposed T

Re: Should GC.malloc be considered 'pure'?

2011-06-09 Thread bearophile
Andrei: > GC.malloc is not technically pure because its result does not only > depend on arguments - it's a fresh value each time. So the compiler > can't apply pure reasoning to it. So is the ptr field of a dynamic array allocated inside a strongly pure function. Did you miss the discussion

Re: Should GC.malloc be considered 'pure'?

2011-06-09 Thread Steven Schveighoffer
On Thu, 09 Jun 2011 16:08:33 -0400, Andrei Alexandrescu wrote: On 6/9/11 12:51 PM, KennyTM~ wrote: Given that the 'new' expression can be used in 'pure', should it be that GC allocation functions like GC.malloc, GC.qalloc and GC.extend (?) be weakly pure also? And should it apply to other ma

Re: Should GC.malloc be considered 'pure'?

2011-06-09 Thread Andrei Alexandrescu
On 6/9/11 12:51 PM, KennyTM~ wrote: Given that the 'new' expression can be used in 'pure', should it be that GC allocation functions like GC.malloc, GC.qalloc and GC.extend (?) be weakly pure also? And should it apply to other managed allocators as well, e.g. the proposed TempAlloc? I'm asking t

Re: Should GC.malloc be considered 'pure'?

2011-06-09 Thread bearophile
Steven Schveighoffer: > Don? Any ideas here? I'm thinking we might need an compiler pragma. > This would be extremely seldom used. We're back to some concept of referential transparency of pointers/reference types, that has produced a tepid response... :-) Bye, bearophile

Re: Should GC.malloc be considered 'pure'?

2011-06-09 Thread Steven Schveighoffer
On Thu, 09 Jun 2011 13:51:31 -0400, KennyTM~ wrote: Given that the 'new' expression can be used in 'pure', should it be that GC allocation functions like GC.malloc, GC.qalloc and GC.extend (?) be weakly pure also? Yes. But one of the possible issues here: weak purity is determined by th

Should GC.malloc be considered 'pure'?

2011-06-09 Thread KennyTM~
Given that the 'new' expression can be used in 'pure', should it be that GC allocation functions like GC.malloc, GC.qalloc and GC.extend (?) be weakly pure also? And should it apply to other managed allocators as well, e.g. the proposed TempAlloc? I'm asking this as one of the specializations