Re: Patterns of Bugs

2011-01-08 Thread Jérôme M. Berger
Jonathan M Davis wrote: On Friday, January 07, 2011 11:06:23 Andrej Mitrovic wrote: On 1/7/11, Walter Bright newshou...@digitalmars.com wrote: Some of them, like the hard drive LED, don't even indicate the polarity on the connector.. I hate those things. There's bunch of LEDs on the PC case

Re: Iain Buclaw earns commit rights to Phobos

2011-01-08 Thread Jérôme M. Berger
Andrei Alexandrescu wrote: Please join me in congratulating Iain Buclaw for earning the right to commit to Phobos. This follows Iain's great work on gdc. Though he's not a Phobos developer outright, having write access to Phobos will allow Iain to quickly port back patches and fixes that he

Re: Patterns of Bugs

2011-01-08 Thread Walter Bright
Jérôme M. Berger wrote: When I built my latest PC, I saw in the MB manual that it would use speech synthesis on the PC speaker to report errors. So I tried to power on the PC without having plugged either CPU or RAM and it started to say NO CPU FOUND! NO CPU FOUND! in a loop with a

Re: Patterns of Bugs

2011-01-08 Thread Jonathan M Davis
On Saturday 08 January 2011 00:16:13 Walter Bright wrote: Jérôme M. Berger wrote: When I built my latest PC, I saw in the MB manual that it would use speech synthesis on the PC speaker to report errors. So I tried to power on the PC without having plugged either CPU or RAM and it

Re: Moving to D

2011-01-08 Thread Russel Winder
Walter, On Fri, 2011-01-07 at 10:54 -0800, Walter Bright wrote: Russel Winder wrote: One thing I would dearly like is to be able to merge branches using meld. http://meld.sourceforge.net/ Why? Because meld makes it easy to review, selectively merge, and do a bit of editing all

Re: Patterns of Bugs

2011-01-08 Thread Walter Bright
Jonathan M Davis wrote: On Saturday 08 January 2011 00:16:13 Walter Bright wrote: Jérôme M. Berger wrote: When I built my latest PC, I saw in the MB manual that it would use speech synthesis on the PC speaker to report errors. So I tried to power on the PC without having plugged

Re: Moving to D

2011-01-08 Thread Walter Bright
Russel Winder wrote: Walter, On Fri, 2011-01-07 at 10:54 -0800, Walter Bright wrote: Russel Winder wrote: One thing I would dearly like is to be able to merge branches using meld. http://meld.sourceforge.net/ Why? Because meld makes it easy to review, selectively merge, and do a bit of

Re: Patterns of Bugs

2011-01-08 Thread Jonathan M Davis
On Saturday 08 January 2011 01:14:41 Walter Bright wrote: Jonathan M Davis wrote: On Saturday 08 January 2011 00:16:13 Walter Bright wrote: Jérôme M. Berger wrote: When I built my latest PC, I saw in the MB manual that it would use speech synthesis on the PC speaker to report errors.

Re: Patterns of Bugs

2011-01-08 Thread Walter Bright
Jonathan M Davis wrote: On and Off would be much better, but I suspect that it's one of those things where they chose symbols instead so that they didn't have to worry about internationalization. That way, it confuses _everyone_ instead of just non- English speakers. ;) I suspect as much,

Re: Immutable nested functions

2011-01-08 Thread Tomek Sowiński
Robert Jacques napisał: 3. (vaguely related) Should there be means to express annotated delegates in general (e.g. pure, nothrow). There is. int delegate(int) pure square = cast( int delegate(int z) pure ) (int z) { return z*z; }; What about

Re: Patterns of Bugs

2011-01-08 Thread Lutger Blijdestijn
Walter Bright wrote: Jonathan M Davis wrote: On and Off would be much better, but I suspect that it's one of those things where they chose symbols instead so that they didn't have to worry about internationalization. That way, it confuses _everyone_ instead of just non- English speakers. ;)

Re: Patterns of Bugs

2011-01-08 Thread bearophile
The Reddit thread about this little article shows some interesting sub-threads: http://www.reddit.com/r/programming/comments/exfnb/patterns_of_bugs/ So I add some more comments to my first answer to the article:

Re: Patterns of Bugs

2011-01-08 Thread Iain Buclaw
== Quote from Lutger Blijdestijn (lutger.blijdest...@gmail.com)'s article Walter Bright wrote: Jonathan M Davis wrote: On and Off would be much better, but I suspect that it's one of those things where they chose symbols instead so that they didn't have to worry about

Re: Patterns of Bugs

2011-01-08 Thread bearophile
Iain Buclaw: On the note of if statements. One pattern of bugs I see on the odd occasion are else statements written like this: if (condition1) if (condition2) statement1; else statement2; Always takes a moment or two to look again and realise it wouldn't

Re: Moving to D

2011-01-08 Thread Jacob Carlborg
On 2011-01-07 03:31, Andrej Mitrovic wrote: On 1/7/11, Vladimir Panteleevvladi...@thecybershadow.net wrote: On Fri, 07 Jan 2011 04:09:04 +0200, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: I don't think git really needs MSYS? I mean I've just installed git again and it does have it's

Re: Moving to D

2011-01-08 Thread Jacob Carlborg
On 2011-01-06 23:26, Nick Sabalausky wrote: Daniel Gibsonmetalcae...@gmail.com wrote in message news:ig57ar$1gn...@digitalmars.com... Am 06.01.2011 20:46, schrieb Walter Bright: Russel Winder wrote: Pity, because using one of Mercurial, Bazaar or Git instead of Subversion is likely the best

Re: DVCS (was Re: Moving to D)

2011-01-08 Thread Russel Winder
On Sat, 2011-01-08 at 15:38 +0100, Jacob Carlborg wrote: On 2011-01-06 21:12, Michel Fortin wrote: [ . . . ] Also when I want an overview with git I just type gitk on the command line to bring a window where I can browser the graph of forks, merges and commits and see the diff for each

Re: Patterns of Bugs

2011-01-08 Thread Iain Buclaw
== Quote from bearophile (bearophileh...@lycos.com)'s article Iain Buclaw: On the note of if statements. One pattern of bugs I see on the odd occasion are else statements written like this: if (condition1) if (condition2) statement1; else statement2;

Re: DVCS (was Re: Moving to D)

2011-01-08 Thread Andrej Mitrovic
Git Extensions looks pretty sweet for use on Windows (I haven't tried it yet though): https://code.google.com/p/gitextensions/

Re: Moving to D

2011-01-08 Thread Iain Buclaw
== Quote from Walter Bright (newshou...@digitalmars.com)'s article Russel Winder wrote: One thing I would dearly like is to be able to merge branches using meld. http://meld.sourceforge.net/ Why? Because meld makes it easy to review, selectively merge, and do a bit of editing all in

Re: Moving to D

2011-01-08 Thread Andrej Mitrovic
On 1/8/11, Jacob Carlborg d...@me.com wrote: Ever heard of TortoiseGit: http://code.google.com/p/tortoisegit/ I can't stand Turtoise projects. They install explorer shells and completely slow down the system whenever I'm browsing through the file system. Turtoise is a perfect name for it.

Re: Patterns of Bugs

2011-01-08 Thread bearophile
Iain Buclaw: http://d.puremagic.com/issues/show_bug.cgi?id=4924 I don't see that as a bug, and that enforces a certain coding style onto the end programmer I agree that's a bit controversial, but a known C lint finds that problem, and every strategy is good against bugs :-) (does no

Re: Patterns of Bugs

2011-01-08 Thread Daniel Gibson
Am 08.01.2011 08:57, schrieb Jérôme M. Berger: Jonathan M Davis wrote: On Friday, January 07, 2011 11:06:23 Andrej Mitrovic wrote: On 1/7/11, Walter Brightnewshou...@digitalmars.com wrote: Some of them, like the hard drive LED, don't even indicate the polarity on the connector.. I hate

Re: Moving to D

2011-01-08 Thread Trass3r
One other random thought: I'd really hate to use a system that didn't have short sequential changeset identifiers. I think Hg does have that, although I don't think all Hg interfaces actually use it, just some. It's built into Mercurial.

Re: Moving to D

2011-01-08 Thread Vladimir Panteleev
On Sat, 08 Jan 2011 17:32:05 +0200, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: On 1/8/11, Jacob Carlborg d...@me.com wrote: Ever heard of TortoiseGit: http://code.google.com/p/tortoisegit/ I can't stand Turtoise projects. They install explorer shells and completely slow down the

Re: DVCS (was Re: Moving to D)

2011-01-08 Thread Lutger Blijdestijn
Walter Bright wrote: Looks like meld itself used git as it's repository. I'd be surprised if it doesn't work with git. :-) I use git for other projects, and meld doesn't work with it. What version are you on? I'm using 1.3.2 and its supports git and mercurial (also committing from inside

Re: Patterns of Bugs

2011-01-08 Thread torhu
On 08.01.2011 15:13, Iain Buclaw wrote: On the note of if statements. One pattern of bugs I see on the odd occasion are else statements written like this: if (condition1) if (condition2) statement1; else statement2; Always takes a moment or two to look again and

Re: Moving to D

2011-01-08 Thread Nick Sabalausky
Andrej Mitrovic andrej.mitrov...@gmail.com wrote in message news:mailman.493.1294500734.4748.digitalmar...@puremagic.com... On 1/8/11, Jacob Carlborg d...@me.com wrote: Ever heard of TortoiseGit: http://code.google.com/p/tortoisegit/ I can't stand Turtoise projects. They install explorer

Re: Moving to D

2011-01-08 Thread Andrej Mitrovic
On 1/8/11, Nick Sabalausky a...@a.a wrote: You need to go into the Icon Overlays section of the settings and set up the Exclude Paths and Include Paths (Exclude everything, ex C:\*, and then include whatever path or paths you keep all your projects in.) Ok thanks, I might give it another try.

Re: Patterns of Bugs

2011-01-08 Thread Jérôme M. Berger
Daniel Gibson wrote: Am 08.01.2011 08:57, schrieb Jérôme M. Berger: When I built my latest PC, I saw in the MB manual that it would use speech synthesis on the PC speaker to report errors. So I tried to power on the PC without having plugged either CPU or RAM and it started to say NO CPU

Re: DVCS (was Re: Moving to D)

2011-01-08 Thread Jacob Carlborg
On 2011-01-08 16:01, Russel Winder wrote: On Sat, 2011-01-08 at 15:38 +0100, Jacob Carlborg wrote: On 2011-01-06 21:12, Michel Fortin wrote: [ . . . ] Also when I want an overview with git I just type gitk on the command line to bring a window where I can browser the graph of forks, merges

Re: Patterns of Bugs

2011-01-08 Thread Nick Sabalausky
Jérôme M. Berger jeber...@free.fr wrote in message news:igaasf$rd...@digitalmars.com... It is an Asus A7N8X. Unless I'm just out-of-date, Asus does tend to be pretty good.

Re: Moving to D

2011-01-08 Thread Nick Sabalausky
Andrej Mitrovic andrej.mitrov...@gmail.com wrote in message news:mailman.459.1294356168.4748.digitalmar...@puremagic.com... I've ever only used hg (mercurial), but only for some private repositories. I'll say one thing: it's pretty damn fast considering it requires Python to work. Also, Joel's

Re: Patterns of Bugs

2011-01-08 Thread Andrej Mitrovic
I wonder if you can hack the thing to say whatever you want.

Re: Patterns of Bugs

2011-01-08 Thread Iain Buclaw
== Quote from Andrej Mitrovic (andrej.mitrov...@gmail.com)'s article I wonder if you can hack the thing to say whatever you want. If you'd could I'd program it to say “Good Afternoon Michael” every time I turn it on.

Re: DVCS (was Re: Moving to D)

2011-01-08 Thread Walter Bright
Lutger Blijdestijn wrote: Walter Bright wrote: Looks like meld itself used git as it's repository. I'd be surprised if it doesn't work with git. :-) I use git for other projects, and meld doesn't work with it. What version are you on? I'm using 1.3.2 and its supports git and mercurial

Re: Patterns of Bugs

2011-01-08 Thread Iain Buclaw
== Quote from torhu (n...@spam.invalid)'s article On 08.01.2011 15:13, Iain Buclaw wrote: On the note of if statements. One pattern of bugs I see on the odd occasion are else statements written like this: if (condition1) if (condition2) statement1; else

Re: Patterns of Bugs

2011-01-08 Thread Ellery Newcomer
On 01/08/2011 02:37 PM, Iain Buclaw wrote: Never let indentation fool you, the else clause will be assumed to be for the first condition. :o) I don't believe you

Re: Patterns of Bugs

2011-01-08 Thread Iain Buclaw
== Quote from Ellery Newcomer (ellery-newco...@utulsa.edu)'s article On 01/08/2011 02:37 PM, Iain Buclaw wrote: Never let indentation fool you, the else clause will be assumed to be for the first condition. :o) I don't believe you Are you saying it *isn't* interpreted as: if (i)

Re: Patterns of Bugs

2011-01-08 Thread Daniel Gibson
Am 08.01.2011 21:53, schrieb Iain Buclaw: == Quote from Ellery Newcomer (ellery-newco...@utulsa.edu)'s article On 01/08/2011 02:37 PM, Iain Buclaw wrote: Never let indentation fool you, the else clause will be assumed to be for the first condition. :o) I don't believe you Are you saying it

Re: Patterns of Bugs

2011-01-08 Thread Walter Bright
bearophile wrote: The problem here is that writing code is a creative thinking process. Bolting things to an airplane is not. This is an important insight that I think Walter article misses. Not at all. Most of software engineering work consists of plugging in subassemblies. In this case,

Re: Patterns of Bugs

2011-01-08 Thread bearophile
Walter: Not at all. Most of software engineering work consists of plugging in subassemblies. In this case, designing the grammar such that the subassemblies of the grammar won't fit together in ways that don't make sense is perfectly analogous. I see and I agree. That

Re: DVCS (was Re: Moving to D)

2011-01-08 Thread Michel Fortin
On 2011-01-08 15:36:39 -0500, Walter Bright newshou...@digitalmars.com said: Lutger Blijdestijn wrote: Walter Bright wrote: Looks like meld itself used git as it's repository. I'd be surprised if it doesn't work with git. :-) I use git for other projects, and meld doesn't work with it.

Re: Moving to D

2011-01-08 Thread Ulrik Mikaelsson
Funny thing about that: After accidentally committing a subdirectory instead of the full project one too many times, I submitted a TortoiseSVN feature request for an option to always commit the full working directory, or at least an option to warn when you're not committing the full working

Re: DVCS (was Re: Moving to D)

2011-01-08 Thread Walter Bright
Michel Fortin wrote: I know you had your reasons, but perhaps it's time for you upgrade to a more recent version of Ubuntu? That version is what comes with Hardy Heron (april 2008). https://launchpad.net/ubuntu/+source/meld I know. The last time I upgraded Ubuntu in place it fd up my

Re: std.unittests for (final?) review

2011-01-08 Thread Jim
I have to agree. assert(1 + 1 3); will always be easier to read than any: assertPred!a b(1 + 1, 3); Why not just keep it simple and straight forward? Anything expressed in the latter form can be expressed in the former.

Issue 1323

2011-01-08 Thread bearophile
Andrei has recently closed issue 1323, it's a small but very useful feature, so I suggest some public discussion: http://d.puremagic.com/issues/show_bug.cgi?id=1323 Lines like this is present thousands of time in my Python code: n in [1, 2, 3] c in hello llo in some_string Bye, bearophile

Re: Issue 1323

2011-01-08 Thread bearophile
Lines like this is present thousands of time in my Python code: Sorry, I meant: Lines like this are present thousands of times in my Python code: Bye, bearophile

Re: Moving to D

2011-01-08 Thread David Nadlinger
On 1/7/11 8:53 AM, Don wrote: What are the advantages of Mercurial over git? (git does allow multiple branches.) Andrei Essentially political and practical rather than technical. […] By the way, I just stumbled upon this page presenting arguments in favor of Git, which seems about as

Re: Issue 1323

2011-01-08 Thread BlazingWhitester
On 2011-01-09 01:20:17 +0200, bearophile said: Andrei has recently closed issue 1323, it's a small but very useful feature, so I suggest some public discussion: http://d.puremagic.com/issues/show_bug.cgi?id=1323 Lines like this is present thousands of time in my Python code: n in [1, 2, 3] c

Re: Issue 1323

2011-01-08 Thread bearophile
BlazingWhitester: If 'in' operator was overladable, users would expect it to have some known complexity. Like O(n) for a linear search in an array. Having sintactic sugar for some operation means that it is supposed to be used widely, and using O(n) operations all over the place is not a

Re: DVCS (was Re: Moving to D)

2011-01-08 Thread Vladimir Panteleev
On Sun, 09 Jan 2011 00:34:19 +0200, Walter Bright newshou...@digitalmars.com wrote: Yeah, I could spend an afternoon doing that. sudo apt-get build-dep meld wget http://ftp.gnome.org/pub/gnome/sources/meld/1.5/meld-1.5.0.tar.bz2 tar jxf meld-1.5.0.tar.bz2 cd meld-1.5.0 make sudo make

Re: DVCS (was Re: Moving to D)

2011-01-08 Thread Andrej Mitrovic
On 1/9/11, Vladimir Panteleev vladi...@thecybershadow.net wrote: On Sun, 09 Jan 2011 00:34:19 +0200, Walter Bright newshou...@digitalmars.com wrote: Yeah, I could spend an afternoon doing that. sudo apt-get build-dep meld wget

Re: DVCS (was Re: Moving to D)

2011-01-08 Thread Vladimir Panteleev
On Sun, 09 Jan 2011 02:34:42 +0200, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: Now do it on Windows!! Now that *would* probably take an afternoon. Done! Just had to install PyGTK. (Luckily for me, meld is written in Python, so there was no need to mess with MinGW :P) From taking

Re: Issue 1323

2011-01-08 Thread Jonathan M Davis
On Saturday 08 January 2011 16:19:21 bearophile wrote: BlazingWhitester: If 'in' operator was overladable, users would expect it to have some known complexity. Like O(n) for a linear search in an array. opIndex is supposed to be restricted to n log(n), I belive (the complexity necessary

Re: Issue 1323

2011-01-08 Thread Robert Clipsham
On 08/01/11 23:20, bearophile wrote: Andrei has recently closed issue 1323, it's a small but very useful feature, so I suggest some public discussion: http://d.puremagic.com/issues/show_bug.cgi?id=1323 Lines like this is present thousands of time in my Python code: n in [1, 2, 3] c in hello

Re: Issue 1323

2011-01-08 Thread Daniel Gibson
Am 09.01.2011 03:03, schrieb Jonathan M Davis: On Saturday 08 January 2011 16:19:21 bearophile wrote: BlazingWhitester: If 'in' operator was overladable, users would expect it to have some known complexity. Like O(n) for a linear search in an array. opIndex is supposed to be restricted to

Re: std.unittests for (final?) review

2011-01-08 Thread Jonathan M Davis
On Saturday 08 January 2011 15:21:44 Jim wrote: I have to agree. assert(1 + 1 3); will always be easier to read than any: assertPred!a b(1 + 1, 3); Why not just keep it simple and straight forward? Anything expressed in the latter form can be expressed in the former. Well,

Re: DVCS (was Re: Moving to D)

2011-01-08 Thread Walter Bright
Vladimir Panteleev wrote: From taking a quick look, I don't see meld's advantage over WinMerge (other than being cross-platform). Thanks for pointing me at winmerge. I've been looking for one to work on Windows.

Re: DVCS (was Re: Moving to D)

2011-01-08 Thread Walter Bright
Vladimir Panteleev wrote: On Sun, 09 Jan 2011 00:34:19 +0200, Walter Bright newshou...@digitalmars.com wrote: Yeah, I could spend an afternoon doing that. sudo apt-get build-dep meld wget http://ftp.gnome.org/pub/gnome/sources/meld/1.5/meld-1.5.0.tar.bz2 tar jxf meld-1.5.0.tar.bz2 cd

Re: DVCS (was Re: Moving to D)

2011-01-08 Thread Jonathan M Davis
On Saturday 08 January 2011 14:34:19 Walter Bright wrote: Michel Fortin wrote: I know you had your reasons, but perhaps it's time for you upgrade to a more recent version of Ubuntu? That version is what comes with Hardy Heron (april 2008). https://launchpad.net/ubuntu/+source/meld I

Re: DVCS (was Re: Moving to D)

2011-01-08 Thread Jonathan M Davis
On Saturday 08 January 2011 10:39:39 Jacob Carlborg wrote: On 2011-01-08 16:01, Russel Winder wrote: On Sat, 2011-01-08 at 15:38 +0100, Jacob Carlborg wrote: On 2011-01-06 21:12, Michel Fortin wrote: [ . . . ] Also when I want an overview with git I just type gitk on the command line

Re: DVCS (was Re: Moving to D)

2011-01-08 Thread Vladimir Panteleev
On Sun, 09 Jan 2011 04:17:21 +0200, Walter Bright newshou...@digitalmars.com wrote: Vladimir Panteleev wrote: From taking a quick look, I don't see meld's advantage over WinMerge (other than being cross-platform). Thanks for pointing me at winmerge. I've been looking for one to work on

Re: Issue 1323

2011-01-08 Thread Jonathan M Davis
On Saturday 08 January 2011 18:10:01 Daniel Gibson wrote: Am 09.01.2011 03:03, schrieb Jonathan M Davis: On Saturday 08 January 2011 16:19:21 bearophile wrote: BlazingWhitester: If 'in' operator was overladable, users would expect it to have some known complexity. Like O(n) for a

Re: Issue 1323

2011-01-08 Thread Andrei Alexandrescu
On 1/8/11 8:10 PM, Daniel Gibson wrote: Am 09.01.2011 03:03, schrieb Jonathan M Davis: On Saturday 08 January 2011 16:19:21 bearophile wrote: BlazingWhitester: If 'in' operator was overladable, users would expect it to have some known complexity. Like O(n) for a linear search in an array.

Re: Issue 1323

2011-01-08 Thread Andrei Alexandrescu
On 1/8/11 8:07 PM, Robert Clipsham wrote: On 08/01/11 23:20, bearophile wrote: Andrei has recently closed issue 1323, it's a small but very useful feature, so I suggest some public discussion: http://d.puremagic.com/issues/show_bug.cgi?id=1323 Lines like this is present thousands of time in my

Re: DVCS (was Re: Moving to D)

2011-01-08 Thread Walter Bright
Jonathan M Davis wrote: Of course, I'd have got nuts having an installation as old as yours appears to be, I think it's less than a year old.

Re: DVCS (was Re: Moving to D)

2011-01-08 Thread Jonathan M Davis
On Saturday 08 January 2011 20:16:05 Walter Bright wrote: Jonathan M Davis wrote: Of course, I'd have got nuts having an installation as old as yours appears to be, I think it's less than a year old. Hmm. I thought that someone said that the version you were running was from 2008. But if

Named tuple from struct

2011-01-08 Thread Guilherme Vieira
Is is possible to get a named tuple from a struct type? E.g.: struct S { int foo; string bar; } S s; S.tupleof t; // S.tupleof is a tuple type, as opposed to s.tupleof, // which yields a tuple instance t[0] = 1; t.bar = 2; If not, I think it would be quite useful. Even still,

Re: auto declarations

2011-01-08 Thread bearophile
Ellery Newcomer: int a = 1, *b = null; Walter has disallowed code like this in D because in C it is a well known source of bugs (so much that C style guides strongly suggest to declare only each variable in a distinct statement and line of code). auto a = 1, b = null; I have discussed

Re: Named tuple from struct

2011-01-08 Thread Jacob Carlborg
On 2011-01-08 09:15, Guilherme Vieira wrote: Is is possible to get a named tuple from a struct type? E.g.: struct S { int foo; string bar; } S s; S.tupleof t; // S.tupleof is a tuple type, as opposed to s.tupleof, // which yields a tuple instance t[0] = 1;

Calling anonymous delegate recursively ?

2011-01-08 Thread tsukikage
eg. to return a fibonacci delegate: return (ulong m) { if(m 2) return m ; return _self_ref(m-1)+_self_ref(m-2) ; } ; Is it possible? Thank you!

Re: Calling anonymous delegate recursively ?

2011-01-08 Thread Pelle
On 01/08/2011 04:45 PM, tsukikage wrote: eg. to return a fibonacci delegate: return (ulong m) { if(m 2) return m ; return _self_ref(m-1)+_self_ref(m-2) ; } ; Is it possible? Thank you! http://en.wikipedia.org/wiki/Fixed_point_combinator#Y_combinator I don't think there's a built in way to

Re: Calling anonymous delegate recursively ?

2011-01-08 Thread Andrej Mitrovic
As a workaround you can do this for now: import std.stdio; enum deleg = returnFib(); ulong delegate(ulong m) returnFib() { return (ulong m) { if(m 2) return m; return deleg(m-1)+deleg(m-2); }; } void main() { writeln(returnFib()(10)); } Otherwise

Re: Calling anonymous delegate recursively ?

2011-01-08 Thread Stewart Gordon
On 08/01/2011 16:00, Pelle wrote: snip http://en.wikipedia.org/wiki/Fixed_point_combinator#Y_combinator snip How are you getting around D not supporting recursively defined types? Stewart.

Re: Calling anonymous delegate recursively ?

2011-01-08 Thread Stewart Gordon
On 08/01/2011 17:40, Andrej Mitrovic wrote: snip Otherwise I'd really like the ability for a lambda to call itself. Perhaps a feature request is in order. I'm not sure what D would gain in practice. If you want a function that calls itself, why not just name the function? Stewart.

Re: Calling anonymous delegate recursively ?

2011-01-08 Thread Andrej Mitrovic
On 1/8/11, Stewart Gordon smjg_1...@yahoo.com wrote: On 08/01/2011 17:40, Andrej Mitrovic wrote: snip Otherwise I'd really like the ability for a lambda to call itself. Perhaps a feature request is in order. I'm not sure what D would gain in practice. If you want a function that calls

Re: Calling anonymous delegate recursively ?

2011-01-08 Thread tsukikage
Thank Pelle , and others. I'm thinking ways to do this task : http://rosettacode.org/wiki/Anonymous_recursion With this last version of Y-combinator http://rosettacode.org/wiki/Y_combinator#D , it look like this: ulong fib(long n) { if(n 0) throw new Exception(No negative) ; return

Re: What's wrong with this code?

2011-01-08 Thread Michal Minich
On Sat, 08 Jan 2011 20:34:39 +, Sean Eskapp wrote: if(left == null) 1) write if (left is null) instead if checking for null. Equality operator is rewritten to a.opEquals(b), which you don't want if you checking for null. this() { left = right = null; } 2) default

Re: What's wrong with this code?

2011-01-08 Thread Tomek Sowiński
Sean Eskapp napisał(a): I had some code that was segfaulting, so I rewrote the basic idea as a fibonacci function, and lo and behold, it still segfaults. Why, and how to fix? This looks fishy: class Fib { private const Fib* left, right; ... this(in Fib left, in Fib right)

Implicit type conversion

2011-01-08 Thread Michal Minich
Use case: import std.variant; void foo (Variant v) {} void main () { Variant v = 3; // ok, this () called v = 3; // ok, opAssing called foo (v); // ok, struct copy, this(this) called foo (3); // error } I'm trying to understand what is needed to make

Re: std.container.Array/RefCounted(T) leaking memory?

2011-01-08 Thread %u
What method are you using to test the memory? I'm puzzled that you've put a comment there rather than the code you're actually using. I'm not using code, I'm checking the working set of my process in Task Manager, and through every iteration, it adds 128 MB. If you run this code twice,

druntime

2011-01-08 Thread Ellery Newcomer
where did libdruntime.a go in dmd.2.051.zip:/linux/lib ?

writef vs writeln and printing to the console

2011-01-08 Thread Andrej Mitrovic
Unfortunately I can't provide a simple test case, but I have a case where using: writef(..\n); inside a loop that runs a dozen times does not print out each line as the statement is reached, instead it prints out everything at once when the application is done. If I use this:

Re: What's wrong with this code? (OP)

2011-01-08 Thread Sean Eskapp
Tomek got it right. Fixed by copying the objects, rather than using pointers. Thanks!

Re: druntime

2011-01-08 Thread Jonathan M Davis
On Saturday 08 January 2011 13:32:19 Ellery Newcomer wrote: where did libdruntime.a go in dmd.2.051.zip:/linux/lib ? I think that it's included inside of libphobos.a now, and has been for a few releases. The libraries are still separate, and you can build them separately, but from what I can

Re: druntime

2011-01-08 Thread Ellery Newcomer
On 01/08/2011 09:02 PM, Jonathan M Davis wrote: On Saturday 08 January 2011 13:32:19 Ellery Newcomer wrote: where did libdruntime.a go in dmd.2.051.zip:/linux/lib ? I think that it's included inside of libphobos.a now, and has been for a few releases. The libraries are still separate, and you

Re: druntime

2011-01-08 Thread Jonathan M Davis
On Saturday 08 January 2011 19:16:26 Ellery Newcomer wrote: On 01/08/2011 09:02 PM, Jonathan M Davis wrote: On Saturday 08 January 2011 13:32:19 Ellery Newcomer wrote: where did libdruntime.a go in dmd.2.051.zip:/linux/lib ? I think that it's included inside of libphobos.a now, and has

Re: interface function overloading

2011-01-08 Thread %u
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article On Saturday 08 January 2011 22:01:11 %u wrote: Isn't it possible to have a hierarchy in interface definitions such that it is possible to overload according to best interface match? This now won't compile due to multiple

[Issue 5427] New: constructors .di files lack modifiers

2011-01-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5427 Summary: constructors .di files lack modifiers Product: D Version: unspecified Platform: Other OS/Version: All Status: NEW Severity: major Priority: P2

[Issue 5427] constructors .di files lack modifiers

2011-01-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5427 Jonathan M Davis jmdavisp...@gmx.com changed: What|Removed |Added Severity|major |normal ---

[Issue 3813] Bad writeln of arrays

2011-01-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3813 --- Comment #10 from bearophile_h...@eml.cc 2011-01-08 03:30:24 PST --- This Python2 program: array1 = [1, 2] print array1 array2 = [1.0, 2.0] print array2 Prints: [1, 2] [1.0, 2.0] This similar D2 program: import std.stdio; void main() {

[Issue 5432] New: if/for/while inconsistency: while( auto a = ... ) does not compile

2011-01-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5432 Summary: if/for/while inconsistency: while( auto a = ... ) does not compile Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity:

[Issue 5433] New: Cannot use auto functions at compile-time

2011-01-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5433 Summary: Cannot use auto functions at compile-time Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2

[Issue 5433] Cannot use auto functions at compile-time

2011-01-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5433 Stewart Gordon s...@iname.com changed: What|Removed |Added Keywords||rejects-valid

[Issue 5428] Broken link in http://www.digitalmars.com/bugs.html to D bugs

2011-01-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5428 Brad Roberts bra...@puremagic.com changed: What|Removed |Added Status|NEW |ASSIGNED

[Issue 816] .dup for associative arrays

2011-01-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=816 Andrei Alexandrescu and...@metalanguage.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 4924] Suspect indentation warning

2011-01-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4924 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 1513] try/catch/finally misbehavior on windows

2011-01-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1513 Don clugd...@yahoo.com.au changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 926] Revival of implicit conversion from Derived[] to Base[] not noted in changelog

2011-01-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=926 Andrei Alexandrescu and...@metalanguage.com changed: What|Removed |Added Priority|P2 |P5

  1   2   >