Contracts for interfaces and abstract classes

2012-08-20 Thread Mike L.
I'm on ubuntu x64 using dmd 2.060 and the following gives an exception: rdmd --main -unittest -version=useInterface mml/sets.d while the following runs just fine: rdmd --main -unittest -version=useAbstractClass mml/sets.d The exception is: object.Exception@src/object_.d(108): need opCmp for

Re: Contracts for interfaces and abstract classes

2012-08-20 Thread Mike L.
Sorry, the title of the thread might be irrelevant, it's just that I was playing around with contracts when I noticed the problem.

Re: foreach for ranges?

2012-07-18 Thread Mike L.
Also, UFCS makes no sense on overloaded operators, because they don't get called with ., and all UFCS is is changing obj.func(params) to func(obj, params). - Jonathan M Davis Ok, that's basically what I was wondering. I had assumed foreach(e; someThing) {} could possibly have been converted

foreach for ranges?

2012-07-17 Thread Mike L.
How exactly does the compiler know how to do foreach on ranges (for example, ones returned by std.algorithm.map ?) I've looked around in std.algorithm and std.range, but can't seem to figure it out.

Re: foreach for ranges?

2012-07-17 Thread Mike L.
Çehreli wrote: On 07/17/2012 11:59 AM, Mike L. wrote: How exactly does the compiler know how to do foreach on ranges (for example, ones returned by std.algorithm.map ?) I've looked around in std.algorithm and std.range, but can't seem to figure it out. The spec mentions it under 'Foreach over

Re: Tempated class instantiation

2009-12-17 Thread Mike L.
Rory McGuire Wrote: Mike L. sgtmuff...@myrealbox.com wrote: Simen kjaeraas Wrote: On Wed, 16 Dec 2009 07:25:39 +0100, Mike L. sgtmuff...@myrealbox.com wrote: I'm making a class template that only works with strings, so I thought it'd be good to instantiate each template

Re: Tempated class instantiation

2009-12-16 Thread Mike L.
Simen kjaeraas Wrote: On Wed, 16 Dec 2009 07:25:39 +0100, Mike L. sgtmuff...@myrealbox.com wrote: I'm making a class template that only works with strings, so I thought it'd be good to instantiate each template with char, wchar, and dchar right in the template's module so

Tempated class instantiation

2009-12-15 Thread Mike L.
I'm making a class template that only works with strings, so I thought it'd be good to instantiate each template with char, wchar, and dchar right in the template's module so that when it's compiled it'll be part of the .obj file and won't have to compile it for every other project that uses

Method overloading and inheritance

2009-07-03 Thread Mike L.
So currently if you want to overload just one case of an overloaded function, you have to use an alias for the class to keep the behavior of the other cases. I talked about it a little in #d, and the only reason that was given was that it might protect the programmer somehow. But why should the

Re: Compiler doesn't see the inherited opApply in this example

2009-07-03 Thread Mike L.
Apparently I'm missing some basic concept about how D does OO since I recreated the problem with a simpler function. I'll re-examine things...

Re: Reminds me of?

2009-07-02 Thread Mike L.
Steve Teale Wrote: No no, you're doing it wrong. It's HITLER that you're supposed to compare them to, not Islamic Fundamentalists.

Should this be a compiler error?

2009-06-07 Thread Mike L.
The following code compiles fine for me with dmd 1.043: -- module wtf; version(Tango) import tango.io.Stdout; else import std.stdio; interface Printer { void print(); } class WTF { Printer p; this(int x) { p = new

Re: Constants?

2009-02-12 Thread Mike L.
Thanks, glad to have it all in one place.

Constants?

2009-02-11 Thread Mike L.
Could someone lay out for me the different ways of doing constants in D (d1, particularly)? I've heard things about const, final, invariant, and anonymous enums?

Why does this work?

2009-01-24 Thread Mike L.
I saved and compiled the code given as getenv.d on the page http://www.digitalmars.com/d/archives/digitalmars/D/learn/623.html but I'm not entirely sure why it works. The reasons that I don't understand it are: 1. GetEnvironmentStringsA() and the other functions aren't mentioned in

Re: Why does this work?

2009-01-24 Thread Mike L.
Denis Koroskin Wrote: Mike L. Wrote: I saved and compiled the code given as getenv.d on the page http://www.digitalmars.com/d/archives/digitalmars/D/learn/623.html but I'm not entirely sure why it works. The reasons that I don't understand it are: 1. GetEnvironmentStringsA