Re: Still no typedef
Arnauld.Loyer@gmail.com wrote:
I don't think it's a debate for the best language, just that declaring
some variable using generics can be quite long.
Map<String, Container<Entity, Comparator<Entity>>> myVariable=...
Iterator<Container<Entity, Comparator<Entity>>> iterator =
myVariable.values().iterator();
suppose the definition of Entity contains also some generics :
Entity becomes Entity<Node, RendererType>
the declaration of the Iterator becomes :
Iterator<Container<Entity<Node, RendererType>, Comparator<Entity<Node,
RendererType>>>>
iterator = ...
which becomes quite long :(
using a kinf of type def :
typedef Entity<Node, RendererType> nodeEntity;
typedef Container<nodeEntity, Comparator<nodeEntity>> containerEntity;
the iterator becomes :
Iterator<containerEntity> iterator = ...
shorter and more readable
Arnauld
There is talk of using type inference to help reduce the verbosity of
generics.
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>