www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - TypeInfo.compare is not implemented

reply Leandro Motta Barros <lmb stackedboxes.org> writes:
Hello,

I my FewDee game prototyping library (https://bitbucket.org/lmb/fewdee) I
ignored most of the usual reccomendations like "be careful with the GC,
it's slow" and "associative arrays are buggy in D, so avoid them". I just
used whatever I found convenient to have my stuff running with minimal
effort.

So, I did something that may be an abuse of D's associative arrays:

alias
  Tuple!(const(GameState), ALLEGRO_EVENT_TYPE)
  stateTypePair;

// GameState is a class, ALLEGRO_EVENT_TYPE is
// some integral data type

EventHandler[EventHandlerID][stateTypePair]
   _eventHandlers;

// EventHandler is a delegate. EventHandlerID is
// an integral type.

This used to work (surprisingly? :-) ) until very recently (when I upgraded
to DMD 2.064, it seems).

Now, I am getting this

   object.Error: TypeInfo.compare is not implemented

when I try to use my '_eventHandlers' AA.

So, any suggestions?

Thanks a lot!

LMB
Nov 30 2013
parent reply Shammah Chancellor <anonymous coward.com> writes:
On 2013-11-30 13:39:15 +0000, Leandro Motta Barros said:

 Hello,
 
 I my FewDee game prototyping library (https://bitbucket.org/lmb/fewdee) 
 I ignored most of the usual reccomendations like "be careful with the 
 GC, it's slow" and "associative arrays are buggy in D, so avoid them". 
 I just used whatever I found convenient to have my stuff running with 
 minimal effort.
 
 So, I did something that may be an abuse of D's associative arrays:
 
 alias
   Tuple!(const(GameState), ALLEGRO_EVENT_TYPE)
   stateTypePair;
 
 // GameState is a class, ALLEGRO_EVENT_TYPE is
 // some integral data type
 
 EventHandler[EventHandlerID][stateTypePair]
    _eventHandlers;
 
 // EventHandler is a delegate. EventHandlerID is
 // an integral type.
 
 This used to work (surprisingly? :-) ) until very recently (when I 
 upgraded to DMD 2.064, it seems).
 
 Now, I am getting this
 
    object.Error: TypeInfo.compare is not implemented
 
 when I try to use my '_eventHandlers' AA.
 
 So, any suggestions?
 
 Thanks a lot!
 
 LMB
DMD version? Can you post a reduced example which produces the error. I can't tell where a typeinfo would be getting used from that example. -Shammah
Nov 30 2013
parent Leandro Motta Barros <lmb stackedboxes.org> writes:
I am terribly sorry, this was a completely lazy question.

So far, I couldn't reproduce the problem in a small example. I'll look
deeper into this before posting again about it.

LMB




On Sat, Nov 30, 2013 at 12:07 PM, Shammah Chancellor
<anonymous coward.com>wrote:

 On 2013-11-30 13:39:15 +0000, Leandro Motta Barros said:

  Hello,
 I my FewDee game prototyping library (https://bitbucket.org/lmb/fewdee)
 I ignored most of the usual reccomendations like "be careful with the GC,
 it's slow" and "associative arrays are buggy in D, so avoid them". I just
 used whatever I found convenient to have my stuff running with minimal
 effort.

 So, I did something that may be an abuse of D's associative arrays:

 alias
   Tuple!(const(GameState), ALLEGRO_EVENT_TYPE)
   stateTypePair;

 // GameState is a class, ALLEGRO_EVENT_TYPE is
 // some integral data type

 EventHandler[EventHandlerID][stateTypePair]
    _eventHandlers;

 // EventHandler is a delegate. EventHandlerID is
 // an integral type.

 This used to work (surprisingly? :-) ) until very recently (when I
 upgraded to DMD 2.064, it seems).

 Now, I am getting this

    object.Error: TypeInfo.compare is not implemented

 when I try to use my '_eventHandlers' AA.

 So, any suggestions?

 Thanks a lot!

 LMB
DMD version? Can you post a reduced example which produces the error. I can't tell where a typeinfo would be getting used from that example. -Shammah
Nov 30 2013