Proposal: Simplified syntax for dealing with parameterized types (correction to ALTERNATIVES section) (original) (raw)
Howard Lovatt howard.lovatt at iee.org
Mon Mar 23 15:33:31 PDT 2009
- Previous message: Anyone ever considered named tuples?
- Next message: Proposal: Simplified syntax for dealing with parameterized types (correction to ALTERNATIVES section)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
There is a lot to like with proposal since class StringList = ArrayList would both shorten declarations and would partially reify the generic class. However there is a problem touched on in the proposal namely class MyStringList = List then StringList sl = ...; MyStringList msl ...; sl = msl; // Error. This problem is worse than suggested in the proposal, consider alternate implementations of the same interface:
class StringList = List; class ArrayStringList = ArrayList;
StringList sl = new ArrayList(); // Error
I think to make this workable you need to either:
change the mechanism so that the interface and abstract class version is simply a shorthand and does not create a new class or type (i.e. simply a type alias), or
alternatively just drop the interface/abstract class bit altogether and say the new mechanism can only be applied to non-abstract classes.
-- Howard.
- Previous message: Anyone ever considered named tuples?
- Next message: Proposal: Simplified syntax for dealing with parameterized types (correction to ALTERNATIVES section)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]