Boo

for must call IDisposable.Dispose on enumerator whenever possible

Details

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

Description

for item in enumerator:
pass

should be equivalent to:

try:
e=enumerator.GetEnumerator():
while e.MoveNext():
item = e.Current
ensure:
cast(IDisposable, e).Dispose() if e isa IDisposable

Activity

Hide
Rodrigo B. de Oliveira added a comment -

This doesn't work well with generator methods since they are implemented using branch instructions and it's not possible to branch into a try block.

Show
Rodrigo B. de Oliveira added a comment - This doesn't work well with generator methods since they are implemented using branch instructions and it's not possible to branch into a try block.
Hide
Daniel Grunwald added a comment -

Implemented in revision 2833.

Show
Daniel Grunwald added a comment - Implemented in revision 2833.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: