August 10, 2010
I often use

struct StructName{ ... }
StructName structName(...){... }

so that the structure doesn't have to be nested...

Fawzi
On 10-ago-10, at 09:18, Walter Bright wrote:

> Can you please revert the change? I thought we were good by passing the unit tests.
>
> Andrei Alexandrescu wrote:
>> I think that shouldn't be changed back; it is one of the first applications of a useful idiom.
>>
>> The compiler bugs and limitations making that example uncompilable should be addressed.
>>
>> Walter, could you please take a look and assess the situation? We discussed the matter briefly on the phone and you agreed that the code is correct.
>>
>>
>> Andrei
>>
>> David Simcha wrote:
>>> Wait a minute, I see what's going on.  Why did someone decide to nest the Filter struct inside the filter() function?  Should this just be changed back?
>>>
>>> On 8/9/2010 9:20 AM, David Simcha wrote:
>>>> I'm receiving a rather inscrutable compile time error on the following test program:
>>>>
>>>> import std.stdio, std.algorithm, std.string;
>>>>
>>>> void main() {
>>>>    auto file = filter!"a.length > 0"(
>>>>        File("foo.txt").byLine()
>>>>    );
>>>> }
>>>>
>>>>
>>>> Error: function std.algorithm.filter!("a.length > 0").filter! (ByLine!(char,char)).filter cannot access frame of function this
>>>>
>>>> I have no idea what this error message means, but I know I've never seen it before.  AFAIK the only change to Filter since the last release has been adding a save() method.
>>>>
>>>>
>>>> On 8/9/2010 2:19 AM, Walter Bright wrote:
>>>>>
>>>>> http://ftp.digitalmars.com/dmd1beta.zip
>>>>> http://ftp.digitalmars.com/dmd2beta.zip
>>>>> _______________________________________________
>>>>> dmd-beta mailing list
>>>>> dmd-beta at puremagic.com
>>>>> http://lists.puremagic.com/mailman/listinfo/dmd-beta
>>>>>
>>>>
>>>
>>> _______________________________________________
>>> dmd-beta mailing list
>>> dmd-beta at puremagic.com
>>> http://lists.puremagic.com/mailman/listinfo/dmd-beta
>> _______________________________________________
>> dmd-beta mailing list
>> dmd-beta at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/dmd-beta
>>
>>
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta

August 10, 2010

David Simcha wrote:
> I'm receiving a rather inscrutable compile time error on the following test program:
>
> import std.stdio, std.algorithm, std.string;
>
> void main() {
>     auto file = filter!"a.length > 0"(
>         File("foo.txt").byLine()
>     );
> }
>
>
> Error: function std.algorithm.filter!("a.length > 0").filter!(ByLine!(char,char)).filter cannot access frame of function this
>

Amazingly, this boils down to just:

struct ByLine {
    ~this();
}

void foo() {
    struct Filter {
        this(ByLine r) { }
    }
}

A fix is on the way.
August 10, 2010
Walter==awesome


Sent by shouting through my showerhead.

On Aug 10, 2010, at 5:22 AM, Walter Bright <walter at digitalmars.com> wrote:

>
>
> David Simcha wrote:
>> I'm receiving a rather inscrutable compile time error on the following test program:
>>
>> import std.stdio, std.algorithm, std.string;
>>
>> void main() {
>>    auto file = filter!"a.length > 0"(
>>        File("foo.txt").byLine()
>>    );
>> }
>>
>>
>> Error: function std.algorithm.filter!("a.length > 0").filter! (ByLine!(char,char)).filter cannot access frame of function this
>>
>
> Amazingly, this boils down to just:
>
> struct ByLine {
>   ~this();
> }
>
> void foo() {
>   struct Filter {
>       this(ByLine r) { }
>   }
> }
>
> A fix is on the way.
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta
August 10, 2010
I won't be able to get work done in the short term; my father in law who was sick with cancer has died and I need to see my wife through it. Will get back to you in a couple days.

Sent by shouting through my showerhead.

On Aug 10, 2010, at 2:18 AM, Walter Bright <walter at digitalmars.com> wrote:

> Can you please revert the change? I thought we were good by passing the unit tests.
>
> Andrei Alexandrescu wrote:
>> I think that shouldn't be changed back; it is one of the first applications of a useful idiom.
>>
>> The compiler bugs and limitations making that example uncompilable should be addressed.
>>
>> Walter, could you please take a look and assess the situation? We discussed the matter briefly on the phone and you agreed that the code is correct.
>>
>>
>> Andrei
>>
>> David Simcha wrote:
>>> Wait a minute, I see what's going on.  Why did someone decide to nest the Filter struct inside the filter() function?  Should this just be changed back?
>>>
>>> On 8/9/2010 9:20 AM, David Simcha wrote:
>>>> I'm receiving a rather inscrutable compile time error on the following test program:
>>>>
>>>> import std.stdio, std.algorithm, std.string;
>>>>
>>>> void main() {
>>>>    auto file = filter!"a.length > 0"(
>>>>        File("foo.txt").byLine()
>>>>    );
>>>> }
>>>>
>>>>
>>>> Error: function std.algorithm.filter!("a.length > 0").filter! (ByLine!(char,char)).filter cannot access frame of function this
>>>>
>>>> I have no idea what this error message means, but I know I've never seen it before.  AFAIK the only change to Filter since the last release has been adding a save() method.
>>>>
>>>>
>>>> On 8/9/2010 2:19 AM, Walter Bright wrote:
>>>>>
>>>>> http://ftp.digitalmars.com/dmd1beta.zip
>>>>> http://ftp.digitalmars.com/dmd2beta.zip
>>>>> _______________________________________________
>>>>> dmd-beta mailing list
>>>>> dmd-beta at puremagic.com
>>>>> http://lists.puremagic.com/mailman/listinfo/dmd-beta
>>>>>
>>>>
>>>
>>> _______________________________________________
>>> dmd-beta mailing list
>>> dmd-beta at puremagic.com
>>> http://lists.puremagic.com/mailman/listinfo/dmd-beta
>> _______________________________________________
>> dmd-beta mailing list
>> dmd-beta at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/dmd-beta
>>
>>
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta
August 10, 2010
New D2 version to fix bug with filter posted.

Walter Bright wrote:
>
> http://ftp.digitalmars.com/dmd1beta.zip http://ftp.digitalmars.com/dmd2beta.zip
>
August 10, 2010
Unfortunately I've found one other problem related to the Filter struct being nested inside filter():

import std.algorithm;

void main() {
     auto arr = [1,2,3,4,5];
     auto m = map!"a + 1"(filter!"a < 4"(arr));
}

d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(114): Error: struct std.algorithm.Map!(result,Filter).Map inner struct Filter cannot be a field

On 8/10/2010 6:44 AM, Walter Bright wrote:
> New D2 version to fix bug with filter posted.
>
> Walter Bright wrote:
>>
>> http://ftp.digitalmars.com/dmd1beta.zip http://ftp.digitalmars.com/dmd2beta.zip
>>
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta
>

August 10, 2010
> New D2 version to fix bug with filter posted.

There's still this problem:

>> Why are there biguintcore.d, biguintnoasm.d and biguintx86.d both in
>> std and
>> std.internal.math?
> They should not be in std. Just delete them.
August 10, 2010
changeset 614

David Simcha wrote:
> Unfortunately I've found one other problem related to the Filter struct being nested inside filter():
>
> import std.algorithm;
>
> void main() {
>     auto arr = [1,2,3,4,5];
>     auto m = map!"a + 1"(filter!"a < 4"(arr));
> }
>
> d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(114): Error: struct std.algorithm.Map!(result,Filter).Map inner struct Filter cannot be a field
>
August 10, 2010
New beta. Fixes OSX bug and filter bug.

Walter Bright wrote:
>
> http://ftp.digitalmars.com/dmd2beta.zip
>
August 10, 2010
Still no go:

import std.algorithm;

void main() {
     auto arr = [1,2,3,4,5];
     auto m = map!"a + 1"(filter!"a < 4"(arr));
}

d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(776): Error: function std.algorithm.Map!(result,Filter).Map.save cannot get frame pointer to filter

This one is fixable, though, by simply making the Filter struct static (which it probably should be anyhow, since it doesn't need access to the filter() function scope as far as I can tell).  Someone who's more sure that this fix is reasonable please either commit it or confirm that it's a good fix so I can.

Also, I just want to point out how I'm finding these issues so others can do the same in parallel.  I don't have any fancy test suites or anything.  All I'm trying to do is compile and unittest a few libraries that I wrote and know the code to inside out.  I know these work on 2.047, so if they don't work on 2.048 and it's not a documented breaking change, then it's a regression.  Because I wrote them and know the code well, it's relatively easy to figure out where the root cause of any problems is.  I think most people on the beta list are the main author of a library or two.  If so, they should probably do the same with their libraries.

On 8/10/2010 7:11 PM, Walter Bright wrote:
> New beta. Fixes OSX bug and filter bug.
>
> Walter Bright wrote:
>>
>> http://ftp.digitalmars.com/dmd2beta.zip
>>
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta
>