Re: confusing (buggy?) closure behaviour

2008-12-12 Thread Frits van Bommel
Zoran Isailovski wrote: I'm an experienced C#, Java and Python programmer, and have employed closures (and C# delegates) upon numerous occasions. While experimenting with D closures and delegates, I was stroke by a phenomenon I cannot explain. Here's the code: [snip] Handler incBy(int n) {

Re: confusing (buggy?) closure behaviour

2008-12-12 Thread Zoran Isailovski
Denis Koroskin Wrote: On Fri, 12 Dec 2008 19:32:03 +0300, Zoran Isailovski dmd@spamgourmet.com wrote: I'm an experienced C#, Java and Python programmer, and have employed closures (and C# delegates) upon numerous occasions. While experimenting with D closures and delegates, I

Re: confusing (buggy?) closure behaviour

2008-12-12 Thread Zoran Isailovski
Frits van Bommel Wrote: Zoran Isailovski wrote: I'm an experienced C#, Java and Python programmer, and have employed closures (and C# delegates) upon numerous occasions. While experimenting with D closures and delegates, I was stroke by a phenomenon I cannot explain. Here's the code:

Re: confusing (buggy?) closure behaviour

2008-12-12 Thread Denis Koroskin
On Fri, 12 Dec 2008 22:28:01 +0300, Zoran Isailovski dmd@spamgourmet.com wrote: Denis Koroskin Wrote: On Fri, 12 Dec 2008 19:32:03 +0300, Zoran Isailovski dmd@spamgourmet.com wrote: I'm an experienced C#, Java and Python programmer, and have employed closures (and C# delegates)

Re: confusing (buggy?) closure behaviour

2008-12-12 Thread Zoran Isailovski
Denis Koroskin Wrote: On Fri, 12 Dec 2008 22:18:28 +0300, Zoran Isailovski dmd@spamgourmet.com wrote: Denis Koroskin Wrote: On Fri, 12 Dec 2008 19:32:03 +0300, Zoran Isailovski dmd@spamgourmet.com wrote: I'm an experienced C#, Java and Python programmer, and have

Why is my code does not compile? (dmd 2.021 linux)

2008-12-12 Thread Weed
void main() { int i; ref int func() { return i; } func() = 4; } lval.d(5): found 'ref' instead of statement lval.d(10): no identifier for declarator func lval.d(11): unrecognized declaration but code like this compiles: ref int func() { int* i = new int;

Re: Why is my code does not compile? (dmd 2.021 linux)

2008-12-12 Thread Bill Baxter
On Sat, Dec 13, 2008 at 5:45 AM, Weed resume...@mail.ru wrote: void main() { int i; ref int func() { return i; } func() = 4; } lval.d(5): found 'ref' instead of statement lval.d(10): no identifier for declarator func lval.d(11): unrecognized declaration but

Re: Why is my code does not compile? (dmd 2.021 linux)

2008-12-12 Thread Weed
Bill Baxter пишет: On Sat, Dec 13, 2008 at 5:45 AM, Weed resume...@mail.ru wrote: void main() { int i; ref int func() { return i; } func() = 4; } lval.d(5): found 'ref' instead of statement lval.d(10): no identifier for declarator func lval.d(11): unrecognized declaration

Re: confusing (buggy?) closure behaviour

2008-12-12 Thread Jérôme M. Berger
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Zoran Isailovski wrote: I'm an experienced C#, Java and Python programmer, and have employed closures (and C# delegates) upon numerous occasions. While experimenting with D closures and delegates, I was stroke by a phenomenon I cannot explain.

Re: Why is my code does not compile? (dmd 2.021 linux)

2008-12-12 Thread Bill Baxter
2008/12/13 Weed resume...@mail.ru: Bill Baxter пишет: On Sat, Dec 13, 2008 at 5:45 AM, Weed resume...@mail.ru wrote: void main() { int i; ref int func() { return i; } func() = 4; } lval.d(5): found 'ref' instead of statement lval.d(10): no identifier for declarator