Boo

Use generic IEnumerable interface for compiling for loops when applicable

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 0.8
  • Fix Version/s: 0.9.2
  • Component/s: Compiler
  • Labels:
    None
  • Number of attachments :
    0

Description

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.

Issue Links

Activity

Hide
Cedric Vivier added a comment - - 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.. :/ )

Show
Cedric Vivier added a comment - - 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.. :/ )
Hide
Cedric Vivier added a comment -

Landed in rev. 3331

Show
Cedric Vivier added a comment - Landed in rev. 3331

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: