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.

Contracts for interfaces and abstract classes

2012-08-19 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: 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 converte

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 &#x

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: Tempated class instantiation

2009-12-17 Thread Mike L.
Rory McGuire Wrote: > Mike L. wrote: > > > Simen kjaeraas Wrote: > > > >> On Wed, 16 Dec 2009 07:25:39 +0100, Mike L. > >> wrote: > >> > >> > I'm making a class template that only works with strings, so I thought > >

Re: Tempated class instantiation

2009-12-16 Thread Mike L.
Simen kjaeraas Wrote: > On Wed, 16 Dec 2009 07:25:39 +0100, Mike L. > 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 templat

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 it.

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...

Compiler doesn't see the inherited opApply in this example

2009-07-03 Thread Mike L.
Hello, can anybody explain why the following code compiles with -version=works but not without? module test; import std.stdio; abstract class Parent { int opApply(int delegate(ref int) dg) { int fakeDelegate(ref uint fake, ref int content)

Re: Template conflict?

2009-02-15 Thread Mike L.
Derek Parnell Wrote: > On Sun, 15 Feb 2009 02:20:50 -0500, Mike L. wrote: > > > Can anybody explain why I get the following error: > > > > test.d(28): Error: test.tblahTemplate!(uint).tblah at test.d(13) conflicts > > with > > test.tb

Template conflict?

2009-02-14 Thread Mike L.
if it's a template? Thanks, Mike L.

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"?

Template Mixin issue

2009-01-29 Thread Mike L.
Hello, I was wondering why the following does not work: interface A(Type) { Type blah(); } template ADefaults(Type, AType : A!(Type)) { Type blah() { return Type.init; } } class B(Type) : A!(Type) { mixin ADefaults!(Type, B!(Type)); } void main()

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 reas

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 std/c/window