Generic classes with number as arguments

LEMAITRE Guillaume <[email protected]>
Newsgroups gmane.comp.lang.eiffel.smalleiffel
Message-ID <[email protected]>
   Hi

I'm trying to write something like this

class TOTO[ N -> NUMBER ]
-- ...
end

and to use it like this

TOTO[ INTEGER ]
or
TOTO[ REAL ]

but, as INTEGER and REAL are expanded classes, this use is not authorized

So, I cannot write TOTO as a generic class, but as a class that uses 
NUMBERs (or instanciate TOTO[ NUMBER ] :) ). That's not what I want, 
because in practice I know I'll use only INTEGER_8, or REAL_32, etc.
Furthermore, the GC goes crazy and consumes about 99% of the execution 
time of my program, and I have no control on that.

A language like C++ ha its drawbacks but allows one to write something 
like this

template< typename T > class Toto { /* ... */ };
Toto< int > ...
Toto< float > ...

even if we never specify which interface T should respect. But this Toto 
class uses int or float and not "generic numbers".

So, shouldn't there be a way to do what I want : Write generic classes 
and use instances with specific type, and not NUMBERs ?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.