DirEntry isDir not working?

2013-02-25 Thread Josh
Code: import std.file; import std.stdio; void main() { writeln(DirEntry(F:\\).isDir()); writeln(DirEntry(F:).isDir()); writeln(DirEntry(F:\\folder\\).isDir()); writeln(DirEntry(F:\\folder).isDir()); writeln(F:\\.isDir()); writeln(F:.isDir());

Re: std.signal woes :/

2013-02-25 Thread Damian
On Sunday, 24 February 2013 at 19:20:06 UTC, cal wrote: On Sunday, 24 February 2013 at 17:30:14 UTC, Damian wrote: That solution is ok for 1 argument but for many arguments it wont suffice. This is issue 5028. What is the problem with many arguments? I'm probably misunderstanding, but e.g.

Re: What does this compile-time error mean?

2013-02-25 Thread Don
On Sunday, 24 February 2013 at 19:13:47 UTC, Jonathan M Davis wrote: On Sunday, February 24, 2013 14:05:26 Timon Gehr wrote: On 02/24/2013 01:59 PM, Maxim Fomin wrote: On Sunday, 24 February 2013 at 09:00:17 UTC, Jonathan M Davis wrote: Because main_cont is module-level variable, it must be

Re: DirEntry isDir not working?

2013-02-25 Thread monarch_dodra
On Monday, 25 February 2013 at 08:20:31 UTC, Josh wrote: [SNIP] Josh Seems like a massive bug in DirEntry: It doesn't have a constructor, meaning anybody using DirEntry will actually get DirEntry.init. The workaround is to use the function dirEntry, which returns an initialized

Re: DirEntry isDir not working?

2013-02-25 Thread Maxim Fomin
On Monday, 25 February 2013 at 12:34:05 UTC, monarch_dodra wrote: On Monday, 25 February 2013 at 08:20:31 UTC, Josh wrote: [SNIP] Josh Seems like a massive bug in DirEntry: It doesn't have a constructor, meaning anybody using DirEntry will actually get DirEntry.init. The workaround is

Re: DirEntry isDir not working?

2013-02-25 Thread monarch_dodra
On Monday, 25 February 2013 at 13:45:31 UTC, Maxim Fomin wrote: On Monday, 25 February 2013 at 12:34:05 UTC, monarch_dodra wrote: On Monday, 25 February 2013 at 08:20:31 UTC, Josh wrote: [SNIP] Josh Seems like a massive bug in DirEntry: It doesn't have a constructor, meaning anybody using

Re: DirEntry isDir not working?

2013-02-25 Thread Maxim Fomin
On Monday, 25 February 2013 at 14:07:10 UTC, monarch_dodra wrote: On Monday, 25 February 2013 at 13:45:31 UTC, Maxim Fomin wrote: On Monday, 25 February 2013 at 12:34:05 UTC, monarch_dodra wrote: On Monday, 25 February 2013 at 08:20:31 UTC, Josh wrote: [SNIP] Josh Seems like a massive bug

Re: __FUNCTION__?

2013-02-25 Thread Vladimir Panteleev
On Monday, 25 February 2013 at 16:32:50 UTC, js.mdnq wrote: We have __FILE__ and __LINE__. Is there a __FUNCTION__ that gives the current function name? This helps with errors. Have a look here: http://wiki.dlang.org/Using_string_mixins_for_logging

Re: __FUNCTION__?

2013-02-25 Thread Nick Treleaven
On 25/02/2013 16:32, js.mdnq wrote: We have __FILE__ and __LINE__. Is there a __FUNCTION__ that gives the current function name? This helps with errors. You can define a string mixin to use instead of __FUNCTION__: enum string parentName = q{__traits(identifier, __traits(parent, {}))}; void

__FUNCTION__?

2013-02-25 Thread js.mdnq
We have __FILE__ and __LINE__. Is there a __FUNCTION__ that gives the current function name? This helps with errors.

Re: DirEntry isDir not working?

2013-02-25 Thread Jonathan M Davis
On Monday, February 25, 2013 13:34:04 monarch_dodra wrote: On Monday, 25 February 2013 at 08:20:31 UTC, Josh wrote: [SNIP] Josh Seems like a massive bug in DirEntry: It doesn't have a constructor, meaning anybody using DirEntry will actually get DirEntry.init. The workaround is to

PostgreSQL driver

2013-02-25 Thread simendsjo
Does anyone have any experience using PostgreSQL with D? I've found several libraries, but I'm uncertain which is usable (if any..) https://github.com/zhaopuming/pqd https://github.com/denizzzka/dpq2

Re: DirEntry isDir not working?

2013-02-25 Thread monarch_dodra
On Monday, 25 February 2013 at 18:23:52 UTC, Jonathan M Davis wrote: What I find most odd is that DirEntry(foo) even compiles. It's not giving you DirEntry.init. It's giving you a DirEntry with its first field initialized (which happens to be its name, but that could theoretically change,

Re: A little of coordination for Rosettacode

2013-02-25 Thread bearophile
You have recently added: http://rosettacode.org/wiki/Parse_command-line_arguments#D http://rosettacode.org/wiki/Old_Russian_measure_of_length#D http://rosettacode.org/wiki/Truth_table#D But maybe there is one more Task you have recently added that I have missed. Bye, bearophile

Re: A little of coordination for Rosettacode

2013-02-25 Thread Jos van Uden
On 25-2-2013 22:54, bearophile wrote: You have recently added: http://rosettacode.org/wiki/Parse_command-line_arguments#D http://rosettacode.org/wiki/Old_Russian_measure_of_length#D http://rosettacode.org/wiki/Truth_table#D Yes. But maybe there is one more Task you have recently added that

Poor error messages and a quiz

2013-02-25 Thread bearophile
Two notes born from a Rosettacode entry (http://rosettacode.org/wiki/Align_columns#D ), but general to deserve their own post. This program has a bug: import std.stdio, std.string, std.algorithm, std.range; void main() { auto data =

get size of class instance (not reference)?

2013-02-25 Thread Nick Sabalausky
These just give me the size of a *reference* to the class: class Foo {...} Foo.sizeof typeid(Foo).tsize How can I get the size of a non-subclassed *instance*?

Re: DirEntry isDir not working?

2013-02-25 Thread Jonathan M Davis
On Monday, February 25, 2013 21:29:28 monarch_dodra wrote: Since you are the one that refactored, what was the point of those _init functions? Wouldn't they have better worked as private constructors? It's the way that it's always been, but I don't currently remember the details of why I made

Re: get size of class instance (not reference)?

2013-02-25 Thread Nick Sabalausky
On Tue, 26 Feb 2013 01:54:44 +0100 bearophile bearophileh...@lycos.com wrote: Nick Sabalausky: How can I get the size of a non-subclassed *instance*? Is this enough? http://dlang.org/traits.html#classInstanceSize Ahh, yes, of course. I had a feeling I was overlooking something

Re: __FUNCTION__?

2013-02-25 Thread Andrej Mitrovic
On 2/25/13, js.mdnq js_adddot+m...@gmail.com wrote: We have __FILE__ and __LINE__. Is there a __FUNCTION__ that gives the current function name? This helps with errors. We'll have it sometime soon. http://d.puremagic.com/issues/show_bug.cgi?id=5140

Re: A little of coordination for Rosettacode

2013-02-25 Thread bearophile
http://rosettacode.org/wiki/Truth_table#D Some changes: http://codepad.org/PEZWmrHG But it's not good enough yet :-) Maybe there are ways to produce a D version closed to the Go one. Bye, bearophile

Re: Difference between DList and SList from garbage collector point of view

2013-02-25 Thread Alexandr Druzhinin
25.02.2013 3:59, monarch_dodra пишет: I don't see any any calls to remove, so I'm not sure what the algorithm is. Wouldn't patch just grow and grow and grow? Regardless, the design of DList is currently flawed (but a pull is open to fix it), in the sense that a DList is just a handle on a

Re: scope(exit) stack = double free or corruption (fasttop) ... help?

2013-02-25 Thread Charles Hixson
On 02/24/2013 05:39 PM, H. S. Teoh wrote: On Sun, Feb 24, 2013 at 03:14:01PM -0800, Charles Hixson wrote: Given a struct with: ~this() { close(); } voidclose() { if (currentKey !is null) currentKey = null; if (cursor is null)return;

Re: A little of coordination for Rosettacode

2013-02-25 Thread Jos van Uden
On 26-2-2013 5:19, bearophile wrote: http://rosettacode.org/wiki/Truth_table#D Some changes: http://codepad.org/PEZWmrHG But it's not good enough yet :-) Maybe there are ways to produce a D version closed to the Go one. I would have prefered to write: bool xor(in bool A, in bool B) pure