History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: BOO-779
Type: Improvement Improvement
Status: Open Open
Priority: Minor Minor
Assignee: Marcus Griep
Reporter: Avishay Lavie
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Boo

Use generic IEnumerable interface for compiling for loops when applicable

Created: 31/Oct/06 03:08 PM   Updated: 09/Jun/08 04:06 PM
Component/s: Compiler
Affects Version/s: 0.8
Fix Version/s: 0.9

Time Tracking:
Not Specified

Issue Links:
Related
dependent
 


 Description  « Hide
When compiling for loops, the compiler always calls IEnumerable.GetEnumerator. When the enumerable implements IEnumerable of T, the compiler should use the generic version to avoid casting or unboxing.

For example:

for i in List of int():
print i

MSIL shows "callvirt IEnumerable.GetEnumerator()" and then "unbox valuetype System.Int32".
Should compile to "callvirt IEnumerable`1<System.Int32>.GetEnumerator()" and no unboxing or casting.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Cedric Vivier - 28/May/08 04:02 AM - edited
We need BOO-1031 fixed first for this to work (and hmm really it looks quite complex and stress the need for a refactoring of ProcessInheritedAbstractMembers.. :/ )