Re: Template class with dispatched properties

2013-11-08 Thread bearophile
Chris Cain: One tiny place of improvement for your code, however, is if you changed it to `static immutable offset = ...;` because that helps the compiler know to do that operation at compile time. The idiomatic way to do that is to use enum offset = ...;. Bye, bearophile

Re: What does func!thing mean?

2013-11-08 Thread Gary Willoughby
On Friday, 8 November 2013 at 08:59:17 UTC, Gary Willoughby wrote: For a friendly introduction to D template system please take a look at this: http://nomad.so/2013/07/templates-in-d-explained/ Then to understand why parens are optional take a look at this:

Re: How to re-initialise an associative array.

2013-11-08 Thread Dicebot
On Friday, 8 November 2013 at 09:04:28 UTC, Gary Willoughby wrote: Does that actually work? I thought you had to assign at least some value. I'm gonna test this. For D arrays and AA's .init, null and [] are pretty much the same thing.

Re: Delegate function access to classes local variable

2013-11-08 Thread Dicebot
On Friday, 8 November 2013 at 12:43:37 UTC, Colin Grogan wrote: import std.stdio; void main() { Column!string col1 = new Column!string( {return test; }, Hello, ); Column!string col2 = new Column!string( {return vars[0]; }, World); // Compilation fail!! Delegate cant see vars[0]

Re: Delegate function access to classes local variable

2013-11-08 Thread Colin Grogan
On Friday, 8 November 2013 at 13:10:10 UTC, Dicebot wrote: On Friday, 8 November 2013 at 12:43:37 UTC, Colin Grogan wrote: import std.stdio; void main() { Column!string col1 = new Column!string( {return test; }, Hello, ); Column!string col2 = new Column!string( {return vars[0]; }, World);

Re: Delegate function access to classes local variable

2013-11-08 Thread Colin Grogan
On Friday, 8 November 2013 at 13:14:33 UTC, Timon Gehr wrote: On 11/08/2013 01:43 PM, Colin Grogan wrote: Hi folks, I'm having some issue getting a delegate function access to a classes member variable. At object construct time, I'm passing in a delegate function, and a list of parameters

balancedParens is not nothrow bug, is this known?

2013-11-08 Thread Gary Willoughby
import std.path; void main(string[] args) { globMatch(foo.bar, *); } compile with: dmd -profile test.d Error: /usr/share/dmd/src/phobos/std/path.d(2187): Error: balancedParens is not nothrow /usr/share/dmd/src/phobos/std/path.d(2188): Error: balancedParens is not nothrow a). Is

Re: balancedParens is not nothrow bug, is this known?

2013-11-08 Thread Gary Willoughby
On Friday, 8 November 2013 at 14:07:38 UTC, Gary Willoughby wrote: import std.path; void main(string[] args) { globMatch(foo.bar, *); } compile with: dmd -profile test.d Error: /usr/share/dmd/src/phobos/std/path.d(2187): Error: balancedParens is not nothrow

Re: spurious gc allocation

2013-11-08 Thread Timon Gehr
On 11/08/2013 07:12 AM, Benjamin Thaut wrote: The problem is that you define the struct Thing as a inner struct. struct Thing only exists in the decompiled version, not in the original source. So far it looks like a bug to me.

Re: balancedParens is not nothrow bug, is this known?

2013-11-08 Thread Gary Willoughby
On Friday, 8 November 2013 at 14:15:05 UTC, Gary Willoughby wrote: Found it: https://d.puremagic.com/issues/show_bug.cgi?id=10295 With that said, anyone have any idea when this is gonna get fixed? Otherwise the profiler is useless for me.

Re: balancedParens is not nothrow bug, is this known?

2013-11-08 Thread simendsjo
On Friday, 8 November 2013 at 14:07:38 UTC, Gary Willoughby wrote: import std.path; void main(string[] args) { globMatch(foo.bar, *); } compile with: dmd -profile test.d Error: /usr/share/dmd/src/phobos/std/path.d(2187): Error: balancedParens is not nothrow

Re: balancedParens is not nothrow bug, is this known?

2013-11-08 Thread bearophile
simendsjo: Can it be nothrow? It might encounter unicode exceptions. I think -profile should not influence the exception tree analysis. So it seems a bug. And there are probably some dupes: https://d.puremagic.com/issues/buglist.cgi?quicksearch=profile+nothrow Bye, bearophile

Re: balancedParens is not nothrow bug, is this known?

2013-11-08 Thread Gary Willoughby
On Friday, 8 November 2013 at 14:17:03 UTC, Gary Willoughby wrote: With that said, anyone have any idea when this is gonna get fixed? Otherwise the profiler is useless for me. In fact i might give it a shot.

Dr. Memory with D

2013-11-08 Thread Namespace
How did I use Dr. Memory with D applications? Every time I try it, my application crash and I get leak errors (maybe because of the GC). My test code is this: import std.stdio; void main() { } So how can I configure Dr. Memory for D?

Re: [Font] Getting font folder on all platforms

2013-11-08 Thread Flamaros
On Tuesday, 15 October 2013 at 23:10:32 UTC, Flamaros wrote: On Friday, 6 September 2013 at 20:54:53 UTC, Flamaros wrote: On Friday, 6 September 2013 at 16:05:43 UTC, Tourist wrote: On Thursday, 5 September 2013 at 19:48:07 UTC, Flamaros wrote: I am searching the right way to find fonts folder

Re: What does func!thing mean?

2013-11-08 Thread ProgrammingGhost
On Friday, 8 November 2013 at 06:25:15 UTC, qznc wrote: On Friday, 8 November 2013 at 05:46:29 UTC, ProgrammingGhost wrote: I'm a D noob. .map!(a = a.length) seems like the lambda is passed into the template. .map!split just confuses me. What is split? I thought only types can be after !. I

Re: Running unittests in a D library

2013-11-08 Thread Flamaros
On Thursday, 20 September 2012 at 18:31:38 UTC, Jacob Carlborg wrote: On 2012-09-20 13:14, Jonathan M Davis wrote: On Thursday, September 20, 2012 12:34:50 Johannes Pfau wrote: But it should be possible. I'm not arguing that it shouldn't be possible. I'm just pointing out that it wouldn't

Re: What does func!thing mean?

2013-11-08 Thread bearophile
ProgrammingGhost: As if split.map was the template parameter. How does it know if split isn't a class (or if d has them, namespace) and map is a static function? Thats why it confused me. D doesn't have namespaces, it has modules and packages. map is a higher order function that returns a

Re: Module or Dictionary corrupt

2013-11-08 Thread Namespace
On Thursday, 7 November 2013 at 04:50:48 UTC, evilrat wrote: On Wednesday, 6 November 2013 at 10:32:01 UTC, Namespace wrote: On Wednesday, 6 November 2013 at 10:21:38 UTC, evilrat wrote: On Wednesday, 6 November 2013 at 10:13:07 UTC, Namespace wrote: Should I open a bug for this? you should

Re: spurious gc allocation

2013-11-08 Thread Ellery Newcomer
On 11/08/2013 06:19 AM, Timon Gehr wrote: On 11/08/2013 07:12 AM, Benjamin Thaut wrote: The problem is that you define the struct Thing as a inner struct. struct Thing only exists in the decompiled version, not in the original source. So far it looks like a bug to me. I've reduced it to

Question about function templates when parameter is void

2013-11-08 Thread Uranuz
I have a question. In my code I want to make uniform template function to call JSON RPC methods (that are regular D functions of any type). So I need some way to call this function with no function params and with them in the same manner. There is a concrete example, because this description