February 09, 2012
On 2/9/12, Jacob Carlborg <doob at me.com> wrote:
> Yes it is. Together with delegates.

I didn't find them next to delegates but after hash literals in the Expressions section. http://www.d-programming-language.org/expression.html#Lambda

It should have usage examples though. It took me a while to figure out what was wrong with this:

void test(int function(int, int) func) {
    func(1, 2);
}

void main() {
    test(x, y => x);
}

Error: undefined identifier x

The fix: test((x, y) => x);
February 09, 2012

On 2/9/2012 11:11 AM, Andrej Mitrovic wrote:
>
> My bad, I've assumed chmgen is distributed with DMD but it's in the dpl.org repository.
>
> Anyway, I get these errors first:
> chmgen.d(355): Error: std.ascii.newline at
>

I've asked Vladimir to have a look at that.
February 10, 2012

On 09 Feb, 2012,at 10:57 PM, Andrej Mitrovic <andrej.mitrovich at gmailcom> wrote:

> On 2/9/12, Jacob Carlborg <doob at me.com> wrote:
> > Yes it is. Together with delegates.
>
> I didn't find them next to delegates but after hash literals in the Expressions section. http://www.d-programming-language.org/expression.html#Lambda

Oh, delegates are documented here as well: http://www.dlang.org/function.html

Seems expression.html is for the actual delegate literal.
>
> It should have usage examples though. It took me a while to figure out what was wrong with this:
>
> void test(int function(int, int) func) {
> func(1, 2);
> }
>
> void main() {
> test(x, y => x);
> }
>
> Error: undefined identifier x
> ?
> The fix: test((x, y) => x);

Yeah, parentheses are required if the lambda takes more than one argument.

--
/Jacob Carlborg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dmd-beta/attachments/20120210/c0ad7ef8/attachment.html>
February 11, 2012
Following code works on dmd 2.057, but causing segmentation fault on dmd 2.058 beta.

-----
struct S
{
    void foo(V)(in V v)
    {
    }

    void foo(Args...)(auto ref const Args args)
    {
        foreach (i, T; Args)
            foo(args[i]);
    }
}

void main()
{
    S s;
    s.foo(10);
}
----

Does anyone report this issue?
This bug is critical for my msgpack-d and related libraries.


Masahiro

2012/2/9 Walter Bright <walter at digitalmars.com>

> http://ftp.digitalmars.com/**dmd2beta.zip<http://ftp.digitalmars.com/dmd2beta.zip>
> ______________________________**_________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/**mailman/listinfo/dmd-beta<http://lists.puremagic.com/mailman/listinfo/dmd-beta>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dmd-beta/attachments/20120211/f2c25ea5/attachment.html>
February 10, 2012

On 2/9/2012 8:48 AM, Nils Bo?ung wrote:
> Phobos pull request #424 should be included: https://github.com/D-Programming-Language/phobos/pull/424 It fixes a regression that was introduced by pull #377.
>

Done.
February 10, 2012

On 2/9/2012 12:02 PM, Nick Sabalausky wrote:
>
>>
>
>
> http://d.puremagic.com/issues/show_bug.cgi?id=7475 Regression(2.058 beta): Template member erroneously inaccessible
>

Done.
February 10, 2012

On 2/9/2012 6:45 AM, kenji hara wrote:
> This is not a fix for any regressions, but need for correct behavior of eponymous template trick described in TDPL. https://github.com/D-Programming-Language/dmd/pull/639
>
> Please merge it in 2.058.
>

Done.
February 10, 2012
Awesome, thanks!

Andrei

On 2/10/12 10:13 AM, Walter Bright wrote:
>
>
> On 2/9/2012 6:45 AM, kenji hara wrote:
>> This is not a fix for any regressions, but need for correct behavior of eponymous template trick described in TDPL. https://github.com/D-Programming-Language/dmd/pull/639
>>
>> Please merge it in 2.058.
>>
>
> Done.
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta
February 10, 2012

On 2/10/2012 8:59 AM, Masahiro Nakagawa wrote:
> Following code works on dmd 2.057, but causing segmentation fault on dmd 2.058 beta.
>
> -----
> struct S
> {
>     void foo(V)(in V v)
>     {
>     }
>
>     void foo(Args...)(auto ref const Args args)
>     {
>         foreach (i, T; Args)
>             foo(args[i]);
>     }
> }
>
> void main()
> {
>     S s;
>     s.foo(10);
> }
> ----
>
> Does anyone report this issue?
> This bug is critical for my msgpack-d and related libraries.
>

This compiles for me without error. When it runs, I get a stack overflow. The reason looks clear - foo(Args) is recursively calling itself. I don't think it's a bug in dmd.
February 11, 2012
On Sat, Feb 11, 2012 at 3:49 AM, Walter Bright <walter at digitalmars.com>wrote:

>
>
> On 2/10/2012 8:59 AM, Masahiro Nakagawa wrote:
>
>> Following code works on dmd 2.057, but causing segmentation fault on dmd 2.058 beta.
>>
>> -----
>> struct S
>> {
>>    void foo(V)(in V v)
>>    {
>>    }
>>
>>    void foo(Args...)(auto ref const Args args)
>>    {
>>        foreach (i, T; Args)
>>            foo(args[i]);
>>    }
>> }
>>
>> void main()
>> {
>>    S s;
>>    s.foo(10);
>> }
>> ----
>>
>> Does anyone report this issue?
>> This bug is critical for my msgpack-d and related libraries.
>>
>>
> This compiles for me without error. When it runs, I get a stack overflow. The reason looks clear - foo(Args) is recursively calling itself. I don't think it's a bug in dmd.
>

I retried above code using new beta on two environments.

Mac OS X 10.6.8 causes segmentation fault, but
Scientific Linux release 6.0 64bit works fine.

Does D allow above code?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dmd-beta/attachments/20120211/24165ea6/attachment.html>