March 06, 2003
"Daniel Yokomiso" <Daniel_member@pathlink.com> wrote in message news:b47sc8$ch3$1@digitaldaemon.com...
> In article <b43dg1$rq7$1@digitaldaemon.com>, Walter says...
> >"Daniel Yokomiso" <daniel_yokomiso@yahoo.com.br> wrote in message news:b432o0$krg$1@digitaldaemon.com...
> >>     It's only possible with global world analysis. Eiffel has such
holes,
> >> and they are trying to close them now, at least some, in the ECMA
> >standard.
> >> I vote against such feature in D. It'll be very easy to produce correct
> ^^^^^^^
> >code
> >> for it if there's no restriction.
> >Hmm, you mean you are against the virtual type feature because you think
it
> >will be too easy to produce incorrect code?
> Errr, yes. My mistake. With such feature (without the restrictions) it'll
be
> easy to forget about covariant attribute type changes when using
frameworks or
> other functions. I believe that's better safe than sorry.

I'm just going to set aside the virtual type thing for the time being, as it clearly needs a lot more thought before it's workable.


March 07, 2003
Long-standing:

   interface Interface
   {
       int foo;
   }

   class Class : Interface
   {
   }

   int main()
   {
       Class x = new Class;
       Interface y = x;

       printf("%d\n", y.foo);
       return 0;
   }

This links, although of course it doesn't work properly - Interface should be rejected by semantic0 for having a field.

March 07, 2003
Here are two minor bugs:


// 1. bug
template Ttest(T)
{
   class Base
   {
   }
}
// DMD crashes if type ".Base" is ommitted
class MyClass : instance Ttest(MyClass)/*.Base*/
{
}


// 2. bug
void func(void function () v)
{

}
int main(char args[][])
{
   static void f1();

   func(&f1);  // works

// error: function func (void(*v)()) does not match argument types (void())

   func(f1);
   return 0;
}


March 12, 2003
Using 0.59.  Long-standing, I think:

   char[][2][] foo;

   void main()
   {
      char[][2] bar;

      foo ~= bar;
   }

This fails compilation with "Internal error: ..\ztc\cod1.c 2608".

March 12, 2003
With DMD 0.59.  This code fails compilation with "Assertion failure: '!scopesym->isWithScopeSymbol()' on line 2241 in file 'mtype.c'":

   class Foo
   {
      struct Bar
      {
      }
   }

   void main()
   {
      with (new Foo)
      {
         Bar z; /* Offending line here. */
      }
   }

March 13, 2003
DMD 0.59.  This code fails to compile with "non-constant expression _init_array___anonymous_ArrayRank__Rank":

    template ArrayRank()
    {
        struct Rank
        {
        }
    }

    template Array()
    {
        struct Array
        {
            typedef instance ArrayRank().Rank Rank1;

            Rank1 data;
        }
    }

    typedef instance Array().Array Array_int1;

This code causes a null memory reference when compiling:

    template ArrayRank()
    {
        struct Rank
        {
        }
    }

    template Array()
    {
        typedef instance ArrayRank() foo;

        struct Array
        {
            foo.Rank data;
        }
    }

    typedef instance Array().Array Array_int1;

March 13, 2003
With DMD 0.59:

   struct vec { int x; }

   typedef vec vec2;

   class Node
   {
      vec2 v;
   }

This fails compilation with "non-constant expression _init_f_vec".

   struct vec { int x; }

   typedef vec vec2 = { 0 };

   class Node
   {
      vec2 v;
   }

Note the initialiser.  This fails compilation with "Assertion failure: '0' on line 154 in file 'init.c'".

March 14, 2003
DMD 0.59, long standing.  This code does not compile, reporting "cannot implicitly convert void* to Object":

   void main()
   {
      Object x;

      x = 0 ? x : null;
   }

March 18, 2003
DMD 0.59.  This code compiles and runs but produces incorrect results:

   interface I
   {
   }

   class C : I
   {
      int x = 432;
   }

   int main()
   {
      C c = new C;

      printf("%p %d\n", c, c.x);
      printf("%p\n", (I) c);
      c = (C) (I) c;
      printf("%p %d\n", c, c.x);
      return 0;
   }

This prints:

   00880FD0 432
   00880FDC
   00880FDC 8720156

So casting from the interface to the instance doesn't adjust the pointer.  When I add a method such as in the following, the cast from the interface to the class results in an Access Violation:

   interface I
   {
      void foo();
   }

   class C : I
   {
      int x = 432;
      void foo() { }
   }

March 19, 2003
DMD 0.59, a two-module error.  Here's module f.d:

   class F
   {
      import g;

      void method();
   }

Here's module g.d:

   import f;

   class G : F
   {
      override void method();
   }

Compiling with "dmd f.d g.d" or "dmd f.d", I get "g.d(5): function method function method does not override any".  This error disappears if the import statement in f.d is moved below the method declaration.