new DIP48: Interface specifications for aggregate types

Simen Kjaeraas simen.kjaras at gmail.com
Mon Sep 9 01:42:31 PDT 2013


On Mon, 09 Sep 2013 09:13:55 +0200, Jacob Carlborg <doob at me.com> wrote:

> On 2013-09-08 20:13, Simen Kjaeraas wrote:
>> In response to Walter's DIP47 I have created my own take on what I see
>> as the main problem:
>>
>> http://wiki.dlang.org/DIP48
>
> As I wrote in the DIP47 thread:
>
> What's wrong with this currently working code:
>
> class Foo
> {
>      void foo ();
>
>      void foo ()
>      {
>          writeln("Foo.foo");
>      }
> }
>
> void main ()
> {
>      auto foo = new Foo;
>      foo.foo();
> }
>

The fact that I can easily write this:

class Foo {
     // Declarations:
     void foo();

     // Definitions:
     void foo() {
         writeln("Foo.foo");
     }

     void bar(int n) {
         writeln("Foo.bar(",n,")");
     }
}

And the compiler will keep completely quiet about bar not being
mentioned in the declarations section.

-- 
Simen


More information about the Digitalmars-d mailing list