Discussions

Blogs: Anonymous Generic Demonstration

  1. Anonymous Generic Demonstration (1 messages)

    In his blog Anonymous generic methods making things "just work", Ted Neward takes the idea of filtering results from the relational world and shows us how this could be coded using anonymous methods in C#. Ted then uses the opportunity to take a jab at Sun for needing type erasure for their implementation of Generics.

    Ted’s challenge to offer an elegant solution to the problem is taken up by Sam Pullara. In Sam's blog, he demonstrates how to get the job done in Java. The challenge is also taken up by Guillaume Laforge and in his blog he shows how to solve this problem using Groovy. This solution is so nice that it makes all the other solutions offered resemble the dogs breakfast which leads us to the point of Marc Logemann’s blog, "perhaps Generics won’t reach the masses"
  2. Anonymous Generic Demonstration[ Go to top ]

    I thought delegates are C#'s advantage over Java until I was involved in some big C# projects. C# delegates are not better then Java interfaces with inner classes. Invoking delegates are slower then invoking methods of an interface, even Microsoft admits.

    And what about anonymous delegates? Java has it since 1997 AFAICR (this is 8 years folks) in the shape of anonymous inner classes. Sam Pullara's example shows that Java 5.0 solution is even more readable and elegant then C# 2.0!

    And what is so wrong with type erasure expect when dealing with arrays? Also, C# 2.0 generics is not ideal too. Consider all the mess with generic and non generic collections. Try to make a class the implement a IEnumerable<TXXX> interface and see what the compiler is asking from you ;).