On Tue, 11 May 2010 16:06:31 -0400, Steven Schveighoffer
wrote:
The ugly solution is to use static if like so:
static if(isIntegral!V)
{
unittest
{
}
}
But that is, well, ugly.
I found a less ugly solution -- remove the braces:
static if(isIntegral!V) unittest
{
...
}
Th
A cool thing I learned on the way to d2.
unittests can be templatized just like the classes/structs they reside
in. When enhancing dcollections with lots of detailed unit tests, I was
doing things like this:
class ArrayList(V)
{
V take() {...}
unittest
{
auto al = new ArrayL
== Quote from Lars T. Kyllingstad (pub...@kyllingen.nospamnet)'s
article
> On Tue, 11 May 2010 15:08:07 +, eles wrote:
> > Maybe I am wrong, but my feeling is that if the complex numbers
were a
> > native type (like creal&co. are now), then it would have been
possible
> > to have a dedicated fo
On Tue, 11 May 2010 15:08:07 +, eles wrote:
> Maybe I am wrong, but my feeling is that if the complex numbers were a
> native type (like creal&co. are now), then it would have been possible
> to have a dedicated formatting (just like %f, %d and %s are) for
> writefln.
>
> Putting the type int
Maybe I am wrong, but my feeling is that if the complex numbers were a native
type (like creal&co. are now), then it would have been possible to have a
dedicated formatting (just like %f, %d and %s are) for writefln.
Putting the type into the library seems to forbid some very nice things:
- init
bearophile wrote:
> Pelle:
>> Not yet, it's not. To compile something that's deprecated, you will need
>> the -d switch.
>
> That's for user code marked with 'deprecated':
> http://www.digitalmars.com/d/2.0/attribute.html#deprecated
> I don't think it is designed to work with compiler/language fe
On Tue, 11 May 2010 09:14:37 -0400, Simen kjaeraas
wrote:
Steven Schveighoffer wrote:
But this function never gets called. I found out recently that
template functions are not allowed in interfaces, which makes it
impossible to use the new operator overloads on interfaces.
The proble
Steven Schveighoffer wrote:
But this function never gets called. I found out recently that template
functions are not allowed in interfaces, which makes it impossible to
use the new operator overloads on interfaces.
The problem is however, that template functions can't be virtual, and
thu
On Tue, 11 May 2010 08:52:47 -0400, Trass3r wrote:
I found out recently that template
functions are not allowed in interfaces, which makes it impossible to
use
the new operator overloads on interfaces.
Wow that should find its way into bugzilla.
Already there :)
http://d.puremagic.com/i
On Tue, 11 May 2010 11:51:34 +, eles wrote:
> the following test case also works:
>
> Compiling
>
> import std.stdio;
> import std.complex;
>
> Complex!(double) x,y;
>
> int main(){
> writefln("salut!\n");
> x.re=1;
> x.im=1;
> y=x.conj();
> writefln("x=%f+%f*
> I found out recently that template
> functions are not allowed in interfaces, which makes it impossible to use
> the new operator overloads on interfaces.
Wow that should find its way into bugzilla.
the following test case also works:
Compiling
import std.stdio;
import std.complex;
Complex!(double) x,y;
int main(){
writefln("salut!\n");
x.re=1;
x.im=1;
y=x.conj();
writefln("x=%f+%f*i\n",x.re,x.im);
writefln("y=%f+%f*i\n",y.re,y.im);
r
Confirmation: in the new beta, the test case for the std.complex
compiles on windows xp with dmd 2.046beta. I cannot post on the
D.phobos newsgroup, but I post the confirmation here.
I did not test it further.
Compiling
import std.complex;
int main(){
return 0;
}
results in:
C:\dmd2>
On Mon, 10 May 2010 19:38:53 -0400, Trass3r wrote:
Yeah it still works for compatibility reasons but is deprecated.
Yeah, but should the old method override the new one?
I assumed one nice thing about "backwards compatibility" is you could do
something like this:
T opOpAssign(string op)(
Pelle:
> Not yet, it's not. To compile something that's deprecated, you will need
> the -d switch.
That's for user code marked with 'deprecated':
http://www.digitalmars.com/d/2.0/attribute.html#deprecated
I don't think it is designed to work with compiler/language features too.
The D1 compiler h
On 05/11/2010 01:38 AM, Trass3r wrote:
Yeah it still works for compatibility reasons but is deprecated.
Not yet, it's not. To compile something that's deprecated, you will need
the -d switch.
Right now, both are allowed, but the old one is scheduled for
deprecation and presumably later remo
16 matches
Mail list logo