Re: Determining if a symbol is a function

2009-04-13 Thread Lars Kyllingstad
Doctor J wrote: Answered my own question: static if (is(typeof(func0) == function)) writefln(func0 is a function.); is() really wants a type, not an expression. You say you want to test whether a struct/class member is a field or a property. Pointers to class and struct methods

Re: Displaying type of something

2009-03-09 Thread Lars Kyllingstad
Georg Wrede wrote: When creating templates, it is sometimes handy to print the type of something. Is there a trivial way to print it? writeln(Typeof T is: , typeof(t)); This doesn't work, but you get the idea. typeof(t).stringof -Lars

Re: Some performance questions

2009-02-03 Thread Lars Kyllingstad
Chris Nicholson-Sauls wrote: Lars Kyllingstad wrote: Daniel Keep wrote: Lars Kyllingstad wrote: [snip] From a performance perspective, however, it carries with it the overhead of an extra function call, which I'm not sure I want. -Lars You're worried about a second function call which

Re: Some performance questions

2009-02-02 Thread Lars Kyllingstad
Jarrett Billingsley wrote: On Mon, Feb 2, 2009 at 8:31 AM, Lars Kyllingstad pub...@kyllingen.nospamnet wrote: I have some functions for which I want to find the nicest possible combination of performance and usability. I have two suggestions as to how they should be defined. Classic style

Re: Some performance questions

2009-02-02 Thread Lars Kyllingstad
Daniel Keep wrote: Lars Kyllingstad wrote: [snip] From a performance perspective, however, it carries with it the overhead of an extra function call, which I'm not sure I want. -Lars You're worried about a second function call which could potentially be inlined, yet you're seemingly

Re: Some performance questions

2009-02-02 Thread Lars Kyllingstad
Lars Kyllingstad wrote: real anotherReturnValue; Correction: real aReturnValue;

Re: Initializing const member post-construction?

2008-10-28 Thread Lars Kyllingstad
Steven Schveighoffer wrote: Jerry Quinn wrote Hi. I'm trying to port a C++ program to D as an exercise in exploring D. As I'm doing this, I've run into a bit of confusion with the const system. I have something like class A {} class B { const A a; void init(A aa) { a = aa; } } This