June 24, 2013
On 06/24/2013 03:05 PM, Craig Dillabaugh wrote:
> I get the following error messages which I cannot decipher.

Oddly enough, I'm also getting lockstep-related error messages at compile-time:

/opt/gdc/include/d/4.8.1/std/range.d:4716: Error: delegate dg (ref double, ref
ulong) is not callable using argument types (double, ulong)
test.d:122: Error: opApply() function for Lockstep!(Result, ulong[]) must return
an int
/opt/gdc/include/d/4.8.1/std/range.d:4717: Error: delegate dg (ulong, ref
double, ref ulong) is not callable using argument types (ulong, double, ulong)

test.d:122 is a foreach over a lockstep:

    foreach(r, x; itemDegree) ...

where itemDegree is generated by the following function:

    auto degreeRank(NodeT)(NodeT nodes)
    {
        size_t[] x;
        foreach(node; nodes)
            x ~= node.links.length;
        x.sort;
        auto r = iota(1.0, 0, -1.0/x.length);
        return lockstep(r, x);
    }

By the way, yes, I know I can probably find a better and more efficient way to generate x than what's there.  It's what I wrote some time ago and never had a pressing enough need to improve. :-P
June 24, 2013
On Monday, 24 June 2013 at 15:29:21 UTC, Joseph Rushton Wakeling
wrote:
> On 06/24/2013 03:05 PM, Craig Dillabaugh wrote:
>> I get the following error messages which I cannot decipher.
>
> Oddly enough, I'm also getting lockstep-related error messages at compile-time:
>
> /opt/gdc/include/d/4.8.1/std/range.d:4716: Error: delegate dg (ref double, ref
> ulong) is not callable using argument types (double, ulong)
> test.d:122: Error: opApply() function for Lockstep!(Result, ulong[]) must return
> an int
> /opt/gdc/include/d/4.8.1/std/range.d:4717: Error: delegate dg (ulong, ref
> double, ref ulong) is not callable using argument types (ulong, double, ulong)
>
> test.d:122 is a foreach over a lockstep:
>
>     foreach(r, x; itemDegree) ...
>
> where itemDegree is generated by the following function:
>
>     auto degreeRank(NodeT)(NodeT nodes)
>     {
>         size_t[] x;
>         foreach(node; nodes)
>             x ~= node.links.length;
>         x.sort;
>         auto r = iota(1.0, 0, -1.0/x.length);
>         return lockstep(r, x);
>     }
>
> By the way, yes, I know I can probably find a better and more efficient way to
> generate x than what's there.  It's what I wrote some time ago and never had a
> pressing enough need to improve. :-P

I think my original attempt compiled at home (where I was using
and older version 2.062), but I couldn't compile it at work with
the latest DMD (2.063).  I didn't mention it in the original post
because I couldn't recall for sure if I had successfully compiled
it.  You appear to be using GDC, but maybe this has something to
do with recent changes.
June 24, 2013
On 06/24/2013 07:05 AM, Craig Dillabaugh wrote:

> The following is a minimal example:

Further reduced:

import std.range;

void main()
{
    lockstep(iota(0, 10), [ 1 ]);
}

Strangely, the error message points at two comment lines in my installation of 2.063:

/usr/include/dmd/phobos/std/range.d(4716): Error: delegate dg (ref int, ref int) is not callable using argument types (int, int)
/usr/include/dmd/phobos/std/range.d(4717): Error: delegate dg (ulong, ref int, ref int) is not callable using argument types (ulong, int, int)

Lines 4716 and 4717 are the two lines of the following comment:

// For generic programming, make sure Lockstep!(Range) is well defined for a
// single range.
template Lockstep(Range)
{
    alias Range Lockstep;
}

Ali

June 24, 2013
On Monday, 24 June 2013 at 16:03:17 UTC, Ali Çehreli wrote:
> On 06/24/2013 07:05 AM, Craig Dillabaugh wrote:
>
> > The following is a minimal example:
>
> Further reduced:
>
> import std.range;
>
> void main()
> {
>     lockstep(iota(0, 10), [ 1 ]);
> }
>
> Strangely, the error message points at two comment lines in my installation of 2.063:
>
> /usr/include/dmd/phobos/std/range.d(4716): Error: delegate dg (ref int, ref int) is not callable using argument types (int, int)
> /usr/include/dmd/phobos/std/range.d(4717): Error: delegate dg (ulong, ref int, ref int) is not callable using argument types (ulong, int, int)
>
> Lines 4716 and 4717 are the two lines of the following comment:
>
> // For generic programming, make sure Lockstep!(Range) is well defined for a
> // single range.
> template Lockstep(Range)
> {
>     alias Range Lockstep;
> }
>
> Ali

Well, I guess my example wasn't so minimal after all :o)

So is this worthy of a bug report then?

June 24, 2013
Craig Dillabaugh:

>> Also note that doesn't iterate the whole ubyte range. Maybe we need another iota range for that, with a different name or with an optional template argument string like "[]" as std.random.uniform. Opinions welcome.
>>
>> Bye,
>> bearophile
>
> Opps.  Of course.
>
> The optional template argument sounds like a good idea.

http://d.puremagic.com/issues/show_bug.cgi?id=10466

Bye,
bearophile
June 24, 2013
On 06/24/2013 11:01 AM, Craig Dillabaugh wrote:

> So is this worthy of a bug report then?

Yes, please.

Ali

June 24, 2013
On 6/24/13, Ali Çehreli <acehreli@yahoo.com> wrote:
> Strangely, the error message points at two comment lines in my installation of 2.063:

It's a regression which I've caused. I've made a fixup pull:

http://d.puremagic.com/issues/show_bug.cgi?id=10468

I'm very sorry for this mishap.
June 25, 2013
On 6/25/13, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote:
> It's a regression which I've caused. I've made a fixup pull:
>
> http://d.puremagic.com/issues/show_bug.cgi?id=10468
>
> I'm very sorry for this mishap.

It's now fixed in git-head. Chances are we're not going to have another 2.063 point release (I'm only speculating) so you may have to use the latest git-head version to use lockstep.
June 25, 2013
On Tuesday, 25 June 2013 at 10:52:22 UTC, Andrej Mitrovic wrote:
> On 6/25/13, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote:
> It's now fixed in git-head. Chances are we're not going to have
> another 2.063 point release (I'm only speculating) so you may have to
> use the latest git-head version to use lockstep.

That's a shame, I'd like to think there'd be a commitment to release regression fixes. Anyway, thanks for getting a fix made, and don't feel too guilty about the regression -- you're just pushing people towards the superior zip :-)

Besides DMD, this fix needs to be propagated to GDC and LDC.
1 2
Next ›   Last »