Re: Which option is faster...

2013-08-06 Thread Andre Artus
It's a long story and I will return in a few months and give you the whole story, but right now, time is not on my side. I have answers for all the questions you folks have asked, and I appreciate all the input. I have the answer that I was looking for, so in a few months, I will come back and

Re: Which option is faster...

2013-08-06 Thread dennis luehring
Am 07.08.2013 06:30, schrieb jicman: Again, what are you trying to achieve? Your statement is not necessarily true, for a myriad of reasons, but it entirely depends on what you want to do. I would reiterate Dennis Luehring's reply, why are you not benching? It seems like you are guessing at what

Re: Which option is faster...

2013-08-06 Thread jicman
On Tuesday, 6 August 2013 at 14:49:42 UTC, Andre Artus wrote: On Tuesday, 6 August 2013 at 12:32:13 UTC, jicman wrote: On Tuesday, 6 August 2013 at 04:10:57 UTC, Andre Artus wrote: On Monday, 5 August 2013 at 13:59:24 UTC, jicman wrote: Greetings! I have this code, foreach (...) { if (std.

Re: Is it possible using reflection or similar to extract only public method names from classes?

2013-08-06 Thread H. S. Teoh
On Tue, Aug 06, 2013 at 11:41:35PM +0200, Gary Willoughby wrote: > Is it possible using reflection or similar to extract only public > method names from classes? I'm thinking how i would go about writing > a unit test/mocking framework, investigating how i can gather > information about such things

Re: Is it possible using reflection or similar to extract only public method names from classes?

2013-08-06 Thread Marek Janukowicz
Gary Willoughby wrote: > Is it possible using reflection or similar to extract only public > method names from classes? I'm thinking how i would go about > writing a unit test/mocking framework, investigating how i can > gather information about such things before i manipulate them. See traits: h

Re: Logging and tracing in D

2013-08-06 Thread Jesse Phillips
On Tuesday, 6 August 2013 at 18:54:50 UTC, Andre Artus wrote: David wrote: There is std.log (proposed), it doesn't work, I don't like its API. I take it that it hasn't been documented yet, at least I could not find it on dlang.org. http://wiki.dlang.org/Review_Queue

Re: Getting number of messages in MessageBox

2013-08-06 Thread Sean Kelly
On Aug 6, 2013, at 1:27 PM, Dmitry Olshansky wrote: > 06-Aug-2013 03:18, Marek Janukowicz пишет: >> I'm using std.concurrency message passing and I'd like to check which thread >> might be a bottleneck. The easiest would be check number of messages piled >> up for each of them, but I could not fi

Re: Logging and tracing in D

2013-08-06 Thread Andre Artus
-- snip -- I take it that it hasn't been documented yet, at least I could not find it on dlang.org. It's currently in the review queue: http://wiki.dlang.org/Review_Queue but marked on hold/suspended. Thanks, I'll check it out later.

Is it possible using reflection or similar to extract only public method names from classes?

2013-08-06 Thread Gary Willoughby
Is it possible using reflection or similar to extract only public method names from classes? I'm thinking how i would go about writing a unit test/mocking framework, investigating how i can gather information about such things before i manipulate them.

Re: Logging and tracing in D

2013-08-06 Thread David
Am 06.08.2013 20:54, schrieb Andre Artus: >> David wrote: >> Am 06.08.2013 19:22, schrieb Andre Artus: >>> -- snip-- and you get pretty formatted message in console(add log file writer if needed), and you get "smart" logging for free, in that way it will be generated only for debug m

Re: Getting number of messages in MessageBox

2013-08-06 Thread Dmitry Olshansky
06-Aug-2013 03:18, Marek Janukowicz пишет: I'm using std.concurrency message passing and I'd like to check which thread might be a bottleneck. The easiest would be check number of messages piled up for each of them, but I could not find a way to do that. Is it possible? Every detail about Message

Re: Logging and tracing in D

2013-08-06 Thread H. S. Teoh
On Tue, Aug 06, 2013 at 08:54:48PM +0200, Andre Artus wrote: > >David wrote: > >Am 06.08.2013 19:22, schrieb Andre Artus: > >>-- snip-- > >>>and you get pretty formatted message in console(add log file writer > >>>if needed), and you get "smart" logging for free, in that way it > >>>will be generat

Re: Logging and tracing in D

2013-08-06 Thread Andre Artus
David wrote: Am 06.08.2013 19:22, schrieb Andre Artus: -- snip-- and you get pretty formatted message in console(add log file writer if needed), and you get "smart" logging for free, in that way it will be generated only for debug mode(in release it will be skipped because of debug specifier)

Re: Logging and tracing in D

2013-08-06 Thread David
Am 06.08.2013 19:22, schrieb Andre Artus: > -- snip-- >> and you get pretty formatted message in console(add log file writer if >> needed), and you get "smart" logging for free, in that way it will be >> generated only for debug mode(in release it will be skipped because of >> debug specifier). >

Re: Logging and tracing in D

2013-08-06 Thread H. S. Teoh
On Tue, Aug 06, 2013 at 07:22:11PM +0200, Andre Artus wrote: > -- snip-- > >and you get pretty formatted message in console(add log file > >writer if needed), and you get "smart" logging for free, in that > >way it will be generated only for debug mode(in release it will be > >skipped because of de

Re: Logging and tracing in D

2013-08-06 Thread Andre Artus
-- snip-- and you get pretty formatted message in console(add log file writer if needed), and you get "smart" logging for free, in that way it will be generated only for debug mode(in release it will be skipped because of debug specifier). Thanks, can I take it that there is no official libra

Re: Logging and tracing in D

2013-08-06 Thread evilrat
On Tuesday, 6 August 2013 at 04:35:39 UTC, Andre Artus wrote: What is the recommended approach for adding logging and tracing to D apps? Is there a library for it? custom very simple yet powerful logging can be achieved with templates and debug specifier, something like this: ---

Re: apply function to parameters

2013-08-06 Thread Artur Skawina
On 08/06/13 18:03, Dicebot wrote: > On Tuesday, 6 August 2013 at 15:51:28 UTC, Jack Applegame wrote: >> On Tuesday, 6 August 2013 at 14:44:18 UTC, bearophile wrote: >>> Take a look at std.typetuple.staticMap >> staticMap works with types, and I don't know how it can help. > > Not really. Anything

Re: apply function to parameters

2013-08-06 Thread Jack Applegame
On Tuesday, 6 August 2013 at 16:03:07 UTC, Dicebot wrote: On Tuesday, 6 August 2013 at 15:51:28 UTC, Jack Applegame wrote: On Tuesday, 6 August 2013 at 14:44:18 UTC, bearophile wrote: Take a look at std.typetuple.staticMap staticMap works with types, and I don't know how it can help. Not rea

Re: X11 XSynchronize() definition in D

2013-08-06 Thread Ali Çehreli
On 08/06/2013 08:46 AM, Ali Çehreli wrote: > On 08/06/2013 03:22 AM, David wrote:>> struct Display > >> {} > > > > D supports opaque structs/pointers > > > > struct Display; > > > > Now Display has to be used as pointer only or the compiler complains > > e.g. about > > > > Display displ

Re: apply function to parameters

2013-08-06 Thread Dicebot
On Tuesday, 6 August 2013 at 15:51:28 UTC, Jack Applegame wrote: On Tuesday, 6 August 2013 at 14:44:18 UTC, bearophile wrote: Take a look at std.typetuple.staticMap staticMap works with types, and I don't know how it can help. Not really. Anything that can be provided to template argument li

Re: apply function to parameters

2013-08-06 Thread Jack Applegame
On Tuesday, 6 August 2013 at 14:44:18 UTC, bearophile wrote: Take a look at std.typetuple.staticMap staticMap works with types, and I don't know how it can help.

Re: X11 XSynchronize() definition in D

2013-08-06 Thread Ali Çehreli
On 08/06/2013 03:22 AM, David wrote:>> struct Display >> {} > > D supports opaque structs/pointers > > struct Display; > > Now Display has to be used as pointer only or the compiler complains > e.g. about > > Display display; Yes and I am sure that is how Xlib.d has it. However, remembering a li

Re: Which option is faster...

2013-08-06 Thread Andre Artus
On Tuesday, 6 August 2013 at 12:32:13 UTC, jicman wrote: On Tuesday, 6 August 2013 at 04:10:57 UTC, Andre Artus wrote: On Monday, 5 August 2013 at 13:59:24 UTC, jicman wrote: Greetings! I have this code, foreach (...) { if (std.string.tolower(fext[0]) == "doc" || std.string.tolower(fext[0

Re: apply function to parameters

2013-08-06 Thread bearophile
Jack Applegame: In other words, I need something like this: foo(magicTemplate!(f, a1, a2, a3...)) === foo(f(a1), f(a2), f(a3)...) Sorry, your second post was not yet present and I misunderstood your question. Take a look at std.typetuple.staticMap Bye, bearophile

Re: apply function to parameters

2013-08-06 Thread bearophile
Jack Applegame: Is there a simple way to do this in D? somefunc(process(args)); Bye, bearophile

Re: apply function to parameters

2013-08-06 Thread Jack Applegame
In other words, I need something like this: foo(magicTemplate!(f, a1, a2, a3...)) === foo(f(a1), f(a2), f(a3)...)

apply function to parameters

2013-08-06 Thread Jack Applegame
In C++11 we can write: template void somefunc(Args... args { ... } template T process(T p) { ... } template void foo(Args... args) { somefunc(process(args)...); } Is there a simple way to do this in D?

Re: Which option is faster...

2013-08-06 Thread H. S. Teoh
On Tue, Aug 06, 2013 at 02:32:11PM +0200, jicman wrote: > On Tuesday, 6 August 2013 at 04:10:57 UTC, Andre Artus wrote: [...] > >What exactly are you trying to do with this? I get the impression > >that there is an attempt at "local optimization" when broader > >approach could lead to better result

Re: Which option is faster...

2013-08-06 Thread Andrej Mitrovic
On 8/5/13, H. S. Teoh wrote: > If you really want optimal performance, use std.regex: Yes and if you also want to bloat your executable to the point that other parts of the system start slowing down.

Re: tuple parameter fwd

2013-08-06 Thread kdmult
On Tuesday, 6 August 2013 at 09:53:33 UTC, Ali Çehreli wrote: Do you mean that when P[0] is already an instance of A, then R should be P[0]. Otherwise, R should be A!P? If so, the following works: class A(P...) { pragma(msg, "\nA: " ~ P.stringof); } class BImpl(R, P...) { pragma(msg,

Re: Which option is faster...

2013-08-06 Thread jicman
On Tuesday, 6 August 2013 at 04:10:57 UTC, Andre Artus wrote: On Monday, 5 August 2013 at 13:59:24 UTC, jicman wrote: Greetings! I have this code, foreach (...) { if (std.string.tolower(fext[0]) == "doc" || std.string.tolower(fext[0]) == "docx" || std.string.tolower(fext[0]) == "xls"

Re: Get attributes of type by string name

2013-08-06 Thread Jacob Carlborg
On 2013-08-02 03:02, JS wrote: how can I get the UDA's of a type that I only know by name and only in a CTFE. I would like to loop over an array of names passed to a me(I don't know their contents beforehand) and get the attributes. I've tried to use a mixin but I can't get the mixin to work on

Re: X11 XSynchronize() definition in D

2013-08-06 Thread andrea9940
@Ali Çehreli Thank you for the explanation. I'll send a pull request to fix Xlib.d

Re: X11 XSynchronize() definition in D

2013-08-06 Thread David
> struct Display > {} D supports opaque structs/pointers struct Display; Now Display has to be used as pointer only or the compiler complains e.g. about Display display;

Re: X11 XSynchronize() definition in D

2013-08-06 Thread Ali Çehreli
On 08/06/2013 01:01 AM, andrea9940 wrote: > Hi, I'm working with the X11 library available from > https://github.com/D-Programming-Deimos/libX11 > If I try to call XSynchronize(display, True) the compilation fails with > "Error: function deimos.X11.Xlib.XSynchronize (_XDisplay*) is not > callable

Re: tuple parameter fwd

2013-08-06 Thread Ali Çehreli
On 08/05/2013 11:45 AM, kdmult wrote: > Hi, > > I would like to use a tuple template parameter in the default value of > another template parameter in the same class declaration as follows. > > class A(P...) {} > > class B(R = A!P, P...) {} > > P... should be rightmost, so how can I use it in the

Re: X11 XSynchronize() definition in D

2013-08-06 Thread andrea9940
On Tuesday, 6 August 2013 at 08:21:26 UTC, bearophile wrote: Try extern(C)? It's not a linkage error, it's a syntax one

Re: Getting number of messages in MessageBox

2013-08-06 Thread Sean Kelly
On Aug 5, 2013, at 4:18 PM, Marek Janukowicz wrote: > I'm using std.concurrency message passing and I'd like to check which thread > might be a bottleneck. The easiest would be check number of messages piled > up for each of them, but I could not find a way to do that. Is it possible? > Every

Re: X11 XSynchronize() definition in D

2013-08-06 Thread bearophile
andrea9940: extern int function( Display*/* display */, Bool/* onoff */ )XSynchronize( Display*/* display */ ); Try extern(C)? Bye, bearophile

Re: Getting number of messages in MessageBox

2013-08-06 Thread Gabi
On Tuesday, 6 August 2013 at 07:47:10 UTC, Marek Janukowicz wrote: dennis luehring wrote: the question is do the published counter then needs locking - and make it slow for all - just for beeing getable? Good point - but I believe the code operating on the counter is synchronized already, so

X11 XSynchronize() definition in D

2013-08-06 Thread andrea9940
Hi, I'm working with the X11 library available from https://github.com/D-Programming-Deimos/libX11 If I try to call XSynchronize(display, True) the compilation fails with "Error: function deimos.X11.Xlib.XSynchronize (_XDisplay*) is not callable using argument types (_XDisplay*, int)" I am su

Re: Getting number of messages in MessageBox

2013-08-06 Thread Marek Janukowicz
dennis luehring wrote: > the question is do the published counter then needs locking - and make > it slow for all - just for beeing getable? Good point - but I believe the code operating on the counter is synchronized already, so synchronized getter would not really slow things down. -- Marek J

Re: Getting number of messages in MessageBox

2013-08-06 Thread dennis luehring
Am 06.08.2013 09:30, schrieb Marek Janukowicz: Gabi wrote: Why not go for the trivial solution - just increase/decrease a counter for each push/pop message? Yeah, that's most likely what I'll end up with, but it's a pity such information exists and I only can't access it because someone decid

Re: Getting number of messages in MessageBox

2013-08-06 Thread Marek Janukowicz
Gabi wrote: > Why not go for the trivial solution - just increase/decrease a > counter for each push/pop message? Yeah, that's most likely what I'll end up with, but it's a pity such information exists and I only can't access it because someone decided to make it private... or should I file a b

Re: Getting number of messages in MessageBox

2013-08-06 Thread Gabi
On Tuesday, 6 August 2013 at 06:15:20 UTC, Marek Janukowicz wrote: Ali Çehreli wrote: On 08/05/2013 04:18 PM, Marek Janukowicz wrote: I'm using std.concurrency message passing and I'd like to check which thread might be a bottleneck. The easiest would be check number of messages piled up for