Details
-
Type:
New Feature
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Compiler, Emitter, Parser, Type System
-
Labels:None
-
Number of attachments :
Description
Being able to consume Generics is required for any CLS-compliant .NET 2.0 language.
Attachments
Issue Links
| This issue is related to: | ||||
| BOO-803 | Generic list and hash builtins |
|
|
|
| This issue depends upon: | ||||
| BOO-763 | Defining new generic types |
|
|
|
| BOO-832 | Defining new generic methods |
|
|
|
| BOO-759 | Invalid IL for generator methods whose yield type is a generic parameter |
|
|
|
| BOO-761 | Implementing generic interfaces |
|
|
|
| BOO-777 | Consuming generic methods |
|
|
|
| BOO-758 | Generic instance for internal types |
|
|
|
| BOO-762 | overriding generic members |
|
|
|
| BOO-760 | Generic callable instantiation |
|
|
|
| BOO-820 | Honor generic parameter constraints when constructing generic types |
|
|
|
| BOO-757 | Generic type references and generic type reference expressions |
|
|
|
| BOO-755 | Type inference for IEnumerable of T |
|
|
|
| BOO-756 | Extending generic types |
|
|
|
| This issue is depended upon by: | ||||
| BOO-447 | Addin for SharpDevelop 2.0 |
|
|
|
I've done some work on point #2 from here: http://groups.google.com/group/boolang/msg/4c49391b6778330f
The attached patch allows for type inference in for-loops over types that implement IEnumerable<T>:
ints = List<int>
ints.Add(21)
for i in ints:
print i * 2
In addition, the patch also allows classes to inherit from constructed generic types, to allow the following:
class MyList(List of int):
pass
ints = MyList()
ints.Add(21)
for i in ints:
print i * 2
The patch defines a new interface, IGenericType, that represents a constructed (or partially constructed) generic type; and a new class, ExternalGenericType, that implements the interface for external constructed generics.
This is my first patch for Boo, so I'd really like to hear your comments (coding style, bugs, etc.)