July 06, 2011
On Wed, Jul 6, 2011 at 8:55 PM, Walter Bright <walter at digitalmars.com> wrote:
>
> 4. fixed missing update to phobos sources

Nope! The commits are still missing from the D1 phobos sources.

Cheers Jakob.
July 06, 2011
On 6 jul 2011, at 21:52, Walter Bright wrote:

> 
> 
> On 7/6/2011 12:09 PM, Jacob Carlborg wrote:
>> 
>> RDMD for Mac OS X and FreeBSD is still missing from the DMD1 zip.
> 
> I'm a little unsure about this as rdmd has not been tested with D1.

It's included for Windows and Linux. I'm using it with D1 on Mac OS X, it's working fine. Why wouldn't it work, rdmd just runs dmd passing in all the dependencies?

>>  The FreeBSD executables in the DMD2 zip doesn't have executable permission.
>> 
> 
> Done.
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta

-- 
/Jacob Carlborg

July 06, 2011
On 2011-07-06 12:50, Jonathan M Davis wrote:
> On 2011-07-06 12:46, Walter Bright wrote:
> > On 7/6/2011 12:08 PM, David Simcha wrote:
> > > Again, where does this leave the weakly pure function issue? I want to be sure that weak purity for non-const member functions is going away forever before I take it out of all my code and test this beta in any detail.
> > 
> > The trouble was that there were a lot of functions marked as 'pure' that were changing things pointed to by its arguments.
> > 
> > I understand that within a pure function, such a pure function could modify locals without the caller becoming impure. But those functions are still impure.
> 
> But they're supposed to be weakly pure, because they don't alter an global or static variables. They're _supposed_ to be able to alter stuff which is passed to them. They're just weakly pure instead of strongly pure and thus can't be optimized out. Then strongly pure functions can call them and retain all of their guarantees. It sounds like you're throwing out the whole idea of weak purity. Certainly, as it stands, weak purity is pretty thoroughly trashed if not outright gone.

Correction, they're weakly pure because they don't access global or static variables which can be mutated (so they can access them if they're immutable or if they're const value types but otherwise can't access them and still be pure).

As I understand it, this is how purity works:

1. A function can be pure if it doesn't can any functions which are not pure and if it doesn't access any global or static variables which can be mutated by anything over the course of the program (so it can access global and static variables which are immutable or which are const value types). It is perfectly legal for a pure function to alter its arguments as long as they're not const or immutable.

2. A function is strongly pure if it can be determined at the call site that it is guaranteed not to alter any of its arguments. At present, that's restricted to functions whose parameters are all either immutable or implicitly convertible to immutable, but there are cases where we could extend that to work with const parameters.

3. A function which is not strongly pure is weakly pure.

4. Calls to strongly pure functions can be optimized out such that if more than one call to a strongly pure function is made within a statement, then the function is called only once, and its result is used for each other instance within the statement where the function would have been called. The optimization could probably be extended further than a single statement under at least some circumstances, but I don't believe that it's currently implemented that way.

5. Calls to weakly pure functions cannot be optimized out, but weakly pure functions can still be called from within strongly pure functions, so it's highly valuable to be able to be able to make functions weakly pure.

The recent purity changes seem to be throwing weakly pure out the window, which is a huge blow to purity in general.

- Jonathan M Davis
July 06, 2011
I bring to the table: http://d.puremagic.com/issues/show_bug.cgi?id=6261

import std.regex;

void main(){
    auto re = regex("foo".dup);
}

src\phobos\std\regex.d(1537): Error: cannot cast a
read-only string literal to mutable in CTFE
src\phobos\std\regex.d(1537): Error: cannot evaluate
tuple("","\x01") at compile time

On Wed, Jul 6, 2011 at 11:55 AM, Walter Bright <walter at digitalmars.com> wrote:
>
> http://ftp.digitalmars.com/dmd1beta.zip http://ftp.digitalmars.com/dmd2beta.zip
>
> 1. updated rdmd
> 2. 64 bit dmd binary on Linux
> 3. CTFE added to D1 changelog
> 4. fixed missing update to phobos sources
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta
>
July 06, 2011

On 7/6/2011 1:23 PM, Jacob Carlborg wrote:
>> I'm a little unsure about this as rdmd has not been tested with D1.
> It's included for Windows and Linux. I'm using it with D1 on Mac OS X, it's working fine. Why wouldn't it work, rdmd just runs dmd passing in all the dependencies?
>

I don't know why it wouldn't work, it just hasn't been tested. I'll add it, though.
July 06, 2011

On 7/6/2011 1:29 PM, Jonathan M Davis wrote:
> On 2011-07-06 12:50, Jonathan M Davis wrote:
>> But they're supposed to be weakly pure, because they don't alter an global or static variables. They're _supposed_ to be able to alter stuff which is passed to them. They're just weakly pure instead of strongly pure and thus can't be optimized out. Then strongly pure functions can call them and retain all of their guarantees. It sounds like you're throwing out the whole idea of weak purity. Certainly, as it stands, weak purity is pretty thoroughly trashed if not outright gone.
> Correction, they're weakly pure because they don't access global or static variables which can be mutated (so they can access them if they're immutable or if they're const value types but otherwise can't access them and still be pure).
>
> As I understand it, this is how purity works:
>
> 1. A function can be pure if it doesn't can any functions which are not pure and if it doesn't access any global or static variables which can be mutated by anything over the course of the program (so it can access global and static variables which are immutable or which are const value types).


>   It is perfectly
> legal for a pure function to alter its arguments as long as they're not const
> or immutable.

This is what I have difficulty with. Consider:

     pure void foo(int* p) { *p = 3; }

That isn't pure, or weakly pure.

> 2. A function is strongly pure if it can be determined at the call site that it is guaranteed not to alter any of its arguments. At present, that's restricted to functions whose parameters are all either immutable or implicitly convertible to immutable, but there are cases where we could extend that to work with const parameters.
>
> 3. A function which is not strongly pure is weakly pure.
>
> 4. Calls to strongly pure functions can be optimized out such that if more than one call to a strongly pure function is made within a statement, then the function is called only once, and its result is used for each other instance within the statement where the function would have been called. The optimization could probably be extended further than a single statement under at least some circumstances, but I don't believe that it's currently implemented that way.
>
> 5. Calls to weakly pure functions cannot be optimized out, but weakly pure functions can still be called from within strongly pure functions, so it's highly valuable to be able to be able to make functions weakly pure.
>
> The recent purity changes seem to be throwing weakly pure out the window, which is a huge blow to purity in general.
>
> - Jonathan M Davis
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta
>
>
July 06, 2011
On Wed, Jul 6, 2011 at 5:09 PM, Walter Bright <walter at digitalmars.com>wrote:


> This is what I have difficulty with. Consider:
>
>    pure void foo(int* p) { *p = 3; }
>
> That isn't pure, or weakly pure.
>

???? Yes it is.  It can be called from a strongly pure function without violating purity  (Any argument passed to foo is local to the strongly pure function, since the arguments have to be immutable and it can't access mutable global or static variables.)  Isn't that the definition of weakly pure?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dmd-beta/attachments/20110706/62dc6ac6/attachment.html>
July 06, 2011

On 7/6/2011 1:23 PM, Jakob Bornecrantz wrote:
> On Wed, Jul 6, 2011 at 8:55 PM, Walter Bright<walter at digitalmars.com>  wrote:
>> 4. fixed missing update to phobos sources
> Nope! The commits are still missing from the D1 phobos sources.
>
>

Which ones?
July 06, 2011
On 2011-07-06 14:09, Walter Bright wrote:
> On 7/6/2011 1:29 PM, Jonathan M Davis wrote:
> > On 2011-07-06 12:50, Jonathan M Davis wrote:
> >> But they're supposed to be weakly pure, because they don't alter an global or static variables. They're _supposed_ to be able to alter stuff which is passed to them. They're just weakly pure instead of strongly pure and thus can't be optimized out. Then strongly pure functions can call them and retain all of their guarantees. It sounds like you're throwing out the whole idea of weak purity. Certainly, as it stands, weak purity is pretty thoroughly trashed if not outright gone.
> > 
> > Correction, they're weakly pure because they don't access global or static variables which can be mutated (so they can access them if they're immutable or if they're const value types but otherwise can't access them and still be pure).
> > 
> > As I understand it, this is how purity works:
> > 
> > 1. A function can be pure if it doesn't can any functions which are not pure and if it doesn't access any global or static variables which can be mutated by anything over the course of the program (so it can access global and static variables which are immutable or which are const value types).
> > 
> > It is perfectly
> > 
> > legal for a pure function to alter its arguments as long as they're not const or immutable.
> 
> This is what I have difficulty with. Consider:
> 
> pure void foo(int* p) { *p = 3; }

And why isn't it weakly pure? If foo is called from a strongly pure function (or is anywhere in the call chain of a strongly pure function), then p cannot possibly point to global or static data. It would have had to have been allocated during the call of the strongly pure function (be it in the strongly pure function itself or in one of the functions in its call chain). So, it doesn't violate the purity of the strongly pure function at all. And if foo is called outside of a pure function (or is anywhere in a call chain which doesn't include a strongly pure function), then it doesn't matter whether p points to a global or static variable.

Sure, a call to foo cannot be optimized away due to purity, but it's definitely weakly pure and does not violate the purity of any strongly pure function which calls it.

- Jonathan M Davis

- Jonathan M Davis
July 06, 2011
On Wed, Jul 6, 2011 at 11:13 PM, Walter Bright <walter at digitalmars.com> wrote:
> On 7/6/2011 1:23 PM, Jakob Bornecrantz wrote:
>> On Wed, Jul 6, 2011 at 8:55 PM, Walter Bright<walter at digitalmars.com> wrote:
>>>
>>> 4. fixed missing update to phobos sources
>>
>> Nope! The commits are still missing from the D1 phobos sources.
>>
>>
>
> Which ones?

The changes to internal/dmain.d, but it seems that the zips are missing all changes to internal/.

Cheers Jakob.