August 17, 2001
Christophe de Dinechin wrote:
> 
> Chris Friesen wrote:
> 
> > I remember the generic types in Eiffel as being very convenient.  Perhaps you could do something equivalent?
> 
> Eiffel and Ada don't have implicit instantiation. That means that you can't implement the STL (or most generic libraries, like Blitz++) in Eiffel or Ada. According to the authors.

I don't know enough about how the STL is coded to comment on that part of it, but I do remember it being much simpler to create generic objects in Eiffel than in C++.  Stack, array, list, queue, binary tree, etc...all become extremely simple to code.

Chris

-- 
Chris Friesen                    | MailStop: 043/33/F10
Nortel Networks                  | work: (613) 765-0557
3500 Carling Avenue              | fax:  (613) 765-2986
Nepean, ON K2H 8E9 Canada        | email: cfriesen@nortelnetworks.com
August 18, 2001
Two things--first, I agree that inheritting from multiple classes gets very messy.  What if only one base class is allowed, but you can 'implement' as many interfaces as desired?  Seems a little lop-sided, but it keeps us clear of the common problems of MI, and allows a type to be i.e. Comparable and Settable in one step.

Second, I wanted to contribute my 0.02USD on templates/GP.  I think they are totally critical to have in a modern language, and I think the way C++ does them is necissary, in that there should be named types.  Consider:

generic(class X, class Y)
class Map
{
    Y operator[] (X) { ... }
}

I'm not sure how you'd accomplish making an L-value out of i.e. mymap[mykey].  Also, I know there are already assoc. arrays, but I think the example is still a good one.

Oops, I brought in an overloaded operator!!  Oh well, I guess that reveals
my feelings about those as well.  c( :
This is a feature/ability I would certainly expect from any modern C-based
language.

 - Brent



August 18, 2001
Chris Friesen wrote:
> 
> Michael Lindner wrote:
> 
> > ...why should the developer have to specify what the
> > types are; the compiler can infer them.
> 
> This would definately be cool.  The compiler would have to check at runtime that all the operations used in a given function are supported by anything that calls that function.  This may be time-consuming.
> 
> Also, some thought must be given on how to make this work with pre-compiled code libraries.  You'd almost have to compile libraries to some intermediate form and then do the final specialization later.

Actually, I was thinking of a more modest version in which the compiler could do the type determination at compile/link time or produce an error. As for libraries, yes, you do need an intermediate form in the case of generic code if the compiler is to specialize at link time.

Note that this requires generic type names as mentioned by Christophe in his response. I simply left them out for brevity.
August 18, 2001
The STL is mostly about algorithms, more even than about types. The fact that the Eiffel syntax is superficially easier than C++ (not difficult, template<> was one of the biggest mistake in C++ history ;-) doesn't contradict the fact that there are things you can't do in Eiffel.

E.g. in Eiffel, it's (almost?) impossible to create a "traits" class and automatically deduce information about the types you are being instantiated with.


Christophe

Chris Friesen wrote:

> Christophe de Dinechin wrote:
> >
> > Chris Friesen wrote:
> >
> > > I remember the generic types in Eiffel as being very convenient.  Perhaps you could do something equivalent?
> >
> > Eiffel and Ada don't have implicit instantiation. That means that you can't implement the STL (or most generic libraries, like Blitz++) in Eiffel or Ada. According to the authors.
>
> I don't know enough about how the STL is coded to comment on that part of it, but I do remember it being much simpler to create generic objects in Eiffel than in C++.  Stack, array, list, queue, binary tree, etc...all become extremely simple to code.
>
> Chris
>
> --
> Chris Friesen                    | MailStop: 043/33/F10
> Nortel Networks                  | work: (613) 765-0557
> 3500 Carling Avenue              | fax:  (613) 765-2986
> Nepean, ON K2H 8E9 Canada        | email: cfriesen@nortelnetworks.com

August 26, 2001
I'm not sure implict instantiation is a good idea, even if it leads to code bloat.

Christophe de Dinechin wrote in message <3B7D2E35.537552AB@earthlink.net>...
>
>Chris Friesen wrote:
>
>> I remember the generic types in Eiffel as being very convenient.  Perhaps
you could do something equivalent?
>
>Eiffel and Ada don't have implicit instantiation. That means that you can't
implement the STL (or most generic
>libraries, like Blitz++) in Eiffel or Ada. According to the authors.
>
>
>Christophe
>


August 26, 2001
Christophe de Dinechin wrote in message <3B7E0470.DB2EB31A@earthlink.net>...
>E.g. in Eiffel, it's (almost?) impossible to create a "traits" class and
automatically deduce information about the
>types you are being instantiated with.


Like what?


1 2
Next ›   Last »