www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Interface member classes have no code generated

reply "Matthew Wilson" <admin.hat stlsoft.dot.org> writes:
I get

    " Error 42: Symbol Undefined
__Class_3std3dtl6common10IContainer9Container"

from the following code


interface IContainer
{
public:
    alias   uint    index_type;
    alias   uint    size_type;

public:
    class Container
        : public IContainer
    {
    public:
        bool        isEmpty();
        IEnumerator enumerate()
        {
            return new Enumerator(this.toArray());
        }

    protected:
        abstract Object[]   toArray();
    }

    alias   Container   selecting_type;

    static selecting_type   hack;

// IContainer methods
public:
    /// Denotes whether the given container is empty
    bool        isEmpty();
    /// Returns an enumerator object representing the elements of the
container
    IEnumerator enumerate();
}
Jul 14 2004
parent reply "Walter" <newshound digitalmars.com> writes:
Interfaces are only supposed to have member functions in them. Anything else
should generate an error.

"Matthew Wilson" <admin.hat stlsoft.dot.org> wrote in message
news:cd4vbd$1ih4$1 digitaldaemon.com...
 I get

     " Error 42: Symbol Undefined
 __Class_3std3dtl6common10IContainer9Container"

 from the following code


 interface IContainer
 {
 public:
     alias   uint    index_type;
     alias   uint    size_type;

 public:
     class Container
         : public IContainer
     {
     public:
         bool        isEmpty();
         IEnumerator enumerate()
         {
             return new Enumerator(this.toArray());
         }

     protected:
         abstract Object[]   toArray();
     }

     alias   Container   selecting_type;

     static selecting_type   hack;

 // IContainer methods
 public:
     /// Denotes whether the given container is empty
     bool        isEmpty();
     /// Returns an enumerator object representing the elements of the
 container
     IEnumerator enumerate();
 }
Jul 16 2004
parent "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
Wow!

If that's the case:

- I'd *like* you to enhance the lang to allow any kinds of member types,
including classes, other interfaces, static members. Given the fact that
interfaces/classes currently don't appear to have their member types accessible
to the outside world, I'm using static members + typeof as a temporary hack.
- I have to suggest that they *must* be allowed to have member aliases/typedefs.
Otherwise, DTL and other template libs are going to be
impossible/crippled/very-unobvious



"Walter" <newshound digitalmars.com> wrote in message
news:cda8ht$ssu$2 digitaldaemon.com...
 Interfaces are only supposed to have member functions in them. Anything else
 should generate an error.

 "Matthew Wilson" <admin.hat stlsoft.dot.org> wrote in message
 news:cd4vbd$1ih4$1 digitaldaemon.com...
 I get

     " Error 42: Symbol Undefined
 __Class_3std3dtl6common10IContainer9Container"

 from the following code


 interface IContainer
 {
 public:
     alias   uint    index_type;
     alias   uint    size_type;

 public:
     class Container
         : public IContainer
     {
     public:
         bool        isEmpty();
         IEnumerator enumerate()
         {
             return new Enumerator(this.toArray());
         }

     protected:
         abstract Object[]   toArray();
     }

     alias   Container   selecting_type;

     static selecting_type   hack;

 // IContainer methods
 public:
     /// Denotes whether the given container is empty
     bool        isEmpty();
     /// Returns an enumerator object representing the elements of the
 container
     IEnumerator enumerate();
 }
Jul 16 2004