http://d.puremagic.com/issues/show_bug.cgi?id=4644



--- Comment #13 from Andrej Mitrovic <andrej.mitrov...@gmail.com> 2010-08-17 
12:41:48 PDT ---
(In reply to comment #11)
> I'm not sure that I understand your question about the msg parameter. If you
> put it in with the function arguments, then you _have_ to give a message every
> time because you can't use default parameters for the first argument. And 
> since
> it would likely be the rare case to add an additional message, that would be
> annoying. With it as an additional template argument, you can have two
> templates - the normal one which omits the message and the more rarely used 
> one
> which includes it.
> 
> I'd argue that for simplicity's sake, your lineFile struct really shouldn't
> need to be declared. You should just be able to make a function call (be it a
> standalone function or a static one on the struct itself) and have it return
> the struct. I think that the struct should get in the way as little as 
> possible
> (since ideally, it wouldn't even be there at all). You could probably just use
> opCall() and do this:
> 
> assertExceptionThrown!(AssertError, myfunc)(LineInfo(), 5);
> 
> Also, we might want to rename the template functions to assertExcThrown() and
> assertExcNotThrown() just because the names are painfully long, albeit nicely
> descriptive.

Yeah, I was looking for a way to get rid of having to create a struct. You'll
have to forgive me, I'm still learning about structs from TDPL and didn't know
about opCall(). :)

As for size_t, well usually I try to request a type of an identifier with
typeid(), and in this case I get an int back (not sure why I've put uint
there). I guess size_t is aliased to int..? 

As for the template, I didn't know you could put both type parameters and value
parameters in the first pair of paranthesis. Btw, I'm getting errors with this
call:

lineFile info;
assertExceptionThrown!("test", core.exception.AssertError, myfunc)(info.call,
5);

test.d(86): Error: tuple T is used as a type

It only works if I comment out the first overloaded template.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to