View Full Document

Iterators can be Independent “from” Their Collections



View the full content.
View Full Document
View Full Document

1 views

Unformatted text preview:

Iterators can be Independent from Their Collections John Boyland William Retert Nanjing University China University of Wisconsin Milkaukee USA boyland cs uwm edu Abstract External iterators pose problems for alias control mechanisms they have access to collection interals and yet are not accessible from the collection they may be used in contexts that are unaware of the collection And yet iterators can benefit from alias control because iterators may fail unexpectedly when their collections are modified We explain a novel aliasing annotation from that indicates when a collection intends to delegate its access to internals to a new object and how it can be given semantics using a fractional permission system We sketch how a static analysis using permissions can statically detect possible concurrent modification exceptions 1 Introduction Iterators in JavaTM and related languages are objects that give sequential access to collections while being external to the collection In particular multiple iterators can operate on a collection at the same time and the collection is not directly involved in the operation of iterators Iterators are an improvement over previous related concepts such as cursors precisely because of this independence Typically a collection only had one cursor and moving the cursor had an effect on the collection Multiple cursors are possible but hard to manage Noble 18 has surveyed a wide variety of iterator architectures we focus here on external iterators An iterator is originally created by the collection but after creation it may be used in contexts in which the collection is neither visible nor in scope The very independence that makes iterators so powerful also makes programs that use them more complex because of the interactions notably aliasing between the collection and the iterators In particular an iterator typically has pointers into the internals of the collection representation and may even perform changes on this representation Figure 1



Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view Iterators can be Independent “from” Their Collections and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Iterators can be Independent “from” Their Collections and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?