Re: Capturing caller's file/line number in variadic template functions

2012-03-16 Thread Yuri Gorobets
On Friday, 16 March 2012 at 18:21:54 UTC, H. S. Teoh wrote: void checkConsistency(T...)(T args, string file=__FILE__, size_t line=__LINE__) { ... } but this causes compile errors because when C==string, then the call is ambiguous. Does it make sense to consider to a

Re: preprocessor pass equivalent?

2012-03-16 Thread H. S. Teoh
On Sat, Mar 17, 2012 at 01:21:56AM +0100, Adam D. Ruppe wrote: > On Saturday, 17 March 2012 at 00:13:33 UTC, H. S. Teoh wrote: > >Playing around with it a little, I notice that it doesn't output > >template bodies, even though calls to template functions are left > >intact. It also doesn't expand [

Re: preprocessor pass equivalent?

2012-03-16 Thread Adam D. Ruppe
On Saturday, 17 March 2012 at 00:13:33 UTC, H. S. Teoh wrote: Playing around with it a little, I notice that it doesn't output template bodies, even though calls to template functions are left intact. It also doesn't expand [] into opIndex/opIndexAssign, I didn't play with this yet.. but it m

Re: preprocessor pass equivalent?

2012-03-16 Thread H. S. Teoh
On Thu, Mar 15, 2012 at 02:51:33PM +0100, Adam D. Ruppe wrote: > On Thursday, 15 March 2012 at 08:35:48 UTC, Jay Norwood wrote: > >Is there some option, similar to -E gcc option, that would > >generate the analogous listing for D? > > You could add one to the compiler in just > a few lines; there'

Re: Capturing caller's file/line number in variadic template functions

2012-03-16 Thread Steven Schveighoffer
On Fri, 16 Mar 2012 14:41:40 -0400, H. S. Teoh wrote: On Fri, Mar 16, 2012 at 02:30:25PM -0400, Steven Schveighoffer wrote: [...] I know this is already answered, but do you get a stack trace? Shouldn't the second stack frame point to the offending line? [...] I didn't compile with debuggi

Re: Capturing caller's file/line number in variadic template functions

2012-03-16 Thread Mantis
16.03.2012 20:35, H. S. Teoh пишет: [...] Actually, I found the solution: the compiler understands __FILE__ and __LINE__ in compile-time arguments too, so this works: void checkConsistency(string file=__FILE__, size_t line=__LINE__, T...)(T args) { ... } It's a bit painful with the assert st

Re: Capturing caller's file/line number in variadic template functions

2012-03-16 Thread H. S. Teoh
On Fri, Mar 16, 2012 at 02:30:25PM -0400, Steven Schveighoffer wrote: [...] > I know this is already answered, but do you get a stack trace? > Shouldn't the second stack frame point to the offending line? [...] I didn't compile with debugging turned on, so it only showed a hex address. Using compi

Re: Capturing caller's file/line number in variadic template functions

2012-03-16 Thread Adam D. Ruppe
On Friday, 16 March 2012 at 18:31:58 UTC, Kevin Cox wrote: But then you have to write it each time. Nah, it just works, at least for the implicit calls: checkConsistency(1, "2", 3); // calls checkConsistenct!(__FILE__, __LINE__, int, string, int)(1, "2", 3);

Re: Capturing caller's file/line number in variadic template functions

2012-03-16 Thread H. S. Teoh
On Fri, Mar 16, 2012 at 02:31:47PM -0400, Kevin Cox wrote: > On Mar 16, 2012 2:29 PM, "Adam D. Ruppe" wrote: > > > > Put the string file = blaha in the template argument list, > > before the variadic. > > > > voic checkConsistency(string file = __FILE__, int line = __LINE__, > T...)(T t) { > > > >

Re: Capturing caller's file/line number in variadic template functions

2012-03-16 Thread Steven Schveighoffer
On Fri, 16 Mar 2012 14:23:37 -0400, H. S. Teoh wrote: I'm writing some unittests with very repetitive tests for a myriad of different types, so I wrote a helper function: version(unittest) { void checkConsistency(T...)(T args) { foreach (a; arg

Re: Capturing caller's file/line number in variadic template functions

2012-03-16 Thread H. S. Teoh
On Fri, Mar 16, 2012 at 08:26:30PM +0200, Mantis wrote: > 16.03.2012 20:23, H. S. Teoh пишет: > >I'm writing some unittests with very repetitive tests for a myriad of > >different types, so I wrote a helper function: > > > > version(unittest) { > > void checkConsistency(T...)(T args

Re: Capturing caller's file/line number in variadic template functions

2012-03-16 Thread Kevin Cox
On Mar 16, 2012 2:29 PM, "Adam D. Ruppe" wrote: > > Put the string file = blaha in the template argument list, > before the variadic. > > voic checkConsistency(string file = __FILE__, int line = __LINE__, T...)(T t) { > > But then you have to write it each time.

Re: Capturing caller's file/line number in variadic template functions

2012-03-16 Thread Adam D. Ruppe
On Friday, 16 March 2012 at 18:21:54 UTC, H. S. Teoh wrote: void checkConsistency(T...)(T args, string file=__FILE__, size_t line=__LINE__) { ... } but this causes compile errors because when C==string, then the call is ambiguous. Is there an easy of working around thi

Re: Capturing caller's file/line number in variadic template functions

2012-03-16 Thread Mantis
16.03.2012 20:23, H. S. Teoh пишет: I'm writing some unittests with very repetitive tests for a myriad of different types, so I wrote a helper function: version(unittest) { void checkConsistency(T...)(T args) { foreach (a; args) {

Capturing caller's file/line number in variadic template functions

2012-03-16 Thread H. S. Teoh
I'm writing some unittests with very repetitive tests for a myriad of different types, so I wrote a helper function: version(unittest) { void checkConsistency(T...)(T args) { foreach (a; args) { assert(isConsistent(a))

Re: State of D toolchain & architecture support?

2012-03-16 Thread Jesse Phillips
On Friday, 16 March 2012 at 08:23:39 UTC, dv wrote: I do not wish to spend time learning something with a shoddy base. If I am to port or create projects with the language, I need solid architecture and compiler support. Can some D users enlighten me about the current state? Platforms I wish t

Re: regex issue

2012-03-16 Thread Joshua Niehus
On Friday, 16 March 2012 at 08:34:18 UTC, Dmitry Olshansky wrote: Ehm, because they have different engines that _should_ give identical results. And the default one apparently has a bug, that I'm looking into. Fill the bug report plz. Ok, submitted: id 7718 Thanks, Josh

Re: Confused about github rebasing

2012-03-16 Thread Jacob Carlborg
On 2012-03-16 09:08, Jonathan M Davis wrote: On Friday, March 16, 2012 08:52:47 Jacob Carlborg wrote: On 2012-03-16 04:52, James Miller wrote: Also, git-svn isn't actually that bad... It is. You can't properly use git because you have to make sure it's compatible with svn, like linear history

Re: regex issue

2012-03-16 Thread Dmitry Olshansky
On 16.03.2012 7:36, Joshua Niehus wrote: Hello, Does anyone know why I would get different results between ctRegex and regex in the following snippet? Ehm, because they have different engines that _should_ give identical results. And the default one apparently has a bug, that I'm looking into

State of D toolchain & architecture support?

2012-03-16 Thread dv
Hello, I am currently evaluating D2, and have questions. Language-wise, D2 looks very interesting to me. I do have concerns about the toolchain and architecture support, however. First of all, there is DMD, LDC, GDC. Of these three, LDC seems to be preferred. x86-64 support is apparently soli

Re: Confused about github rebasing

2012-03-16 Thread Jonathan M Davis
On Friday, March 16, 2012 08:52:47 Jacob Carlborg wrote: > On 2012-03-16 04:52, James Miller wrote: > > Also, git-svn isn't actually that bad... > > It is. You can't properly use git because you have to make sure it's > compatible with svn, like linear history. If you don't have a linear > history

Re: Confused about github rebasing

2012-03-16 Thread Jacob Carlborg
On 2012-03-16 04:52, James Miller wrote: Also, git-svn isn't actually that bad... It is. You can't properly use git because you have to make sure it's compatible with svn, like linear history. If you don't have a linear history you're in big trouble. -- /Jacob Carlborg