Environmental Acquisition Revisited Richard Cobbe and Matthias - - PowerPoint PPT Presentation

environmental acquisition revisited
SMART_READER_LITE
LIVE PREVIEW

Environmental Acquisition Revisited Richard Cobbe and Matthias - - PowerPoint PPT Presentation

Environmental Acquisition Revisited Richard Cobbe and Matthias Felleisen Northeastern University Environmental Acquisition Revisited POPL 2005 p.1/30 What is Acquisition? Environmental Acquisition Revisited POPL 2005 p.2/30


slide-1
SLIDE 1

Environmental Acquisition Revisited

Richard Cobbe and Matthias Felleisen Northeastern University

Environmental Acquisition Revisited — POPL 2005 – p.1/30

slide-2
SLIDE 2

What is Acquisition?

Environmental Acquisition Revisited — POPL 2005 – p.2/30

slide-3
SLIDE 3

Example: Swing Containers

JDialog JRootPane JPanel JPanel JPanel JButton

✂ ✂ ✄ ☎ ✆ ✝ ✞

located only at top level

✠ ✄ ✄ ✂ ✝

must chase pointers to access root pane

Environmental Acquisition Revisited — POPL 2005 – p.3/30

slide-4
SLIDE 4

Example: Financial Application

TaxInfo getTaxPolicy() { ... } Fund funds TaxInfo taxPolicy MutualFund Fund Account TaxInfo taxPolicy Fund funds int fundID int balance FundGroup

Operations on

✂ ✄

s must know tax policy

Environmental Acquisition Revisited — POPL 2005 – p.4/30

slide-5
SLIDE 5

Example: Financial Application

contains acquires contains MutualFund Account TaxInfo taxPolicy int fundID int balance TaxInfo taxPolicy Fund funds Fund funds FundGroup TaxInfo taxPolicy Fund

Operations on

✂ ✄

s must know tax policy With acquisition, no longer need to maintain and chase parent refs

Environmental Acquisition Revisited — POPL 2005 – p.4/30

slide-6
SLIDE 6

Example: IDE Wizard

errorMessage( ) UnionInfo vPanel HorizontalPanel ... Dialog ClassUnionWizard errorMessage( ) produce( ) add( ) VariantPanel produce( )

Environmental Acquisition Revisited — POPL 2005 – p.5/30

slide-7
SLIDE 7

Example: Wizard with Acquisition

acquires errorMessage( ) UnionInfo vPanel HorizontalPanel ... Dialog ClassUnionWizard errorMessage( ) produce( ) add( ) VariantPanel produce( )

Environmental Acquisition Revisited — POPL 2005 – p.6/30

slide-8
SLIDE 8

Containment Invariants

Invariants ensured by language support for acquisition:

Environmental Acquisition Revisited — POPL 2005 – p.7/30

slide-9
SLIDE 9

Containment Invariants

Invariants ensured by language support for acquisition:

  • Objects allow access to their containers

Environmental Acquisition Revisited — POPL 2005 – p.7/30

slide-10
SLIDE 10

Containment Invariants

Invariants ensured by language support for acquisition:

  • Objects allow access to their containers
  • Two-way links (or their analog) are consistent

Environmental Acquisition Revisited — POPL 2005 – p.7/30

slide-11
SLIDE 11

Restrictions on Acquisition

  • Limit object’s “environment” to its containers
  • Only specifically marked fields establish containment

relationship

  • An object may have at most one container
  • Object containment cycles forbidden

Environmental Acquisition Revisited — POPL 2005 – p.8/30

slide-12
SLIDE 12

Jacques: the Formal Model

Environmental Acquisition Revisited — POPL 2005 – p.9/30

slide-13
SLIDE 13

Jacques

Based on ClassicJava, formal model of Java by Flatt, Krishnamurthi, and Felleisen (1998). Supported features:

  • core OO: classes, inheritance, method dispatch
  • field assignment

Environmental Acquisition Revisited — POPL 2005 – p.10/30

slide-14
SLIDE 14

Jacques

Based on ClassicJava, formal model of Java by Flatt, Krishnamurthi, and Felleisen (1998). Supported features:

  • core OO: classes, inheritance, method dispatch
  • field assignment
  • field and method acquisition
  • explicit marks for “containment” fields
  • list of possible containers in class definitions

Environmental Acquisition Revisited — POPL 2005 – p.10/30

slide-15
SLIDE 15

Wizard Example

✆ ✂ ✂ ✄ ✝ ☎ ✂ ✝ ✆ ✝ ✝ ✂ ✞ ✞ ✄ ✞ ✝ ✟ ✂ ✠ ✁ ✆ ✂ ✂ ✄ ✝ ☎ ✂ ✝ ✡ ☎ ☛ ✆ ☞ ✟ ✌ ✍ ✆ ☞ ☎ ✆ ✝ ✄ ☎ ✆ ✝ ✞ ✁ ✎ ☎ ✆ ✝ ✞ ✁ ✏ ✑ ✑ ✑ ✒
✆ ✂ ✂ ✍ ✆ ☞ ☎ ✆ ✝ ✄ ☎ ✆ ✝ ✞ ✁ ✞ ✞ ✄ ✞ ✝ ✟ ✂ ✓ ✂ ☞ ☎ ☛ ✂ ✝ ✄ ✆ ✁ ☎ ✆ ✝ ✞ ✁ ✌ ✟ ✠ ✄ ✄ ✂ ✝ ✞ ✟ ☎ ✄ ✟ ✠ ✄ ✄ ✂ ✝ ✏ ✎ ✂ ☎ ✟ ✆ ✟ ✟ ✔ ✑ ✑ ✑ ✕ ✌ ✑ ✑ ✑ ✒ ✎ ✂ ☎ ✟ ✖ ☞ ✂ ✟ ✠
✔ ✑ ✑ ✑ ✕ ✌ ✑ ✑ ✑ ✒ ✎ ✂ ☎ ✟ ✞ ☞ ☞ ✂ ☞ ✗ ✞ ✂ ✂ ✆ ✘ ✞ ✔ ✙ ✄ ☞ ☎ ✝ ✘ ✚ ✂ ✘ ✕ ✌ ✑ ✑ ✑ ✒ ✒

Environmental Acquisition Revisited — POPL 2005 – p.11/30

slide-16
SLIDE 16

Jacques: Wizard Example

✆ ✂ ✂ ✄ ✝ ☎ ✂ ✝ ✆ ✝ ✝ ✂ ✞ ✞ ✄ ✞ ✝ ✟ ✂ ✠ ✁ ✆ ✂ ✂ ✄ ✝ ☎ ✂ ✝ ✡ ☎ ☛ ✆ ☞ ✟ ✌
✝ ✄ ✆ ☎ ✝ ✂ ✍ ✆ ☞ ☎ ✆ ✝ ✄ ☎ ✆ ✝ ✞ ✁ ✎ ☎ ✆ ✝ ✞ ✁ ✏ ✑ ✑ ✑ ✒
✆ ✂ ✂ ✍ ✆ ☞ ☎ ✆ ✝ ✄ ☎ ✆ ✝ ✞ ✁ ✞ ✞ ✄ ✞ ✝ ✟ ✂ ✓ ✂ ☞ ☎ ☛ ✂ ✝ ✄ ✆ ✁ ☎ ✆ ✝ ✞ ✁
✝ ✄ ✆ ☎ ✝ ✞ ✟ ✠ ✁ ✆ ✂ ✂ ✄ ✝ ☎ ✂ ✝ ✡ ☎ ☛ ✆ ☞ ✟ ✌ ✟ ✠ ✄ ✄ ✂ ✝ ✞ ✟ ☎ ✄ ✟ ✠ ✄ ✄ ✂ ✝ ✏ ✎ ✂ ☎ ✟ ✆ ✟ ✟ ✔ ✑ ✑ ✑ ✕ ✌ ✑ ✑ ✑ ✒ ✎ ✂ ☎ ✟ ✖ ☞ ✂ ✟ ✠
✔ ✑ ✑ ✑ ✕ ✌ ✑ ✑ ✑ ✒ ✆
☎ ☞ ✞ ✂ ✎ ✂ ☎ ✟ ✞ ☞ ☞ ✂ ☞ ✗ ✞ ✂ ✂ ✆ ✘ ✞ ✔ ✙ ✄ ☞ ☎ ✝ ✘ ✚ ✂ ✘ ✕ ✏ ✒

Environmental Acquisition Revisited — POPL 2005 – p.12/30

slide-17
SLIDE 17

Static Check I

C : contained B contains D d B : contained A int fd contains C c A bool fd contains B b acquires int fd D : contained C

Environmental Acquisition Revisited — POPL 2005 – p.13/30

slide-18
SLIDE 18

Static Check I

C : contained B contains D d B : contained A int fd contains C c A bool fd contains B b acquires int fd D : contained C

  • acquires
✝ ✟

from

, and types match. Program is well-typed.

Environmental Acquisition Revisited — POPL 2005 – p.13/30

slide-19
SLIDE 19

Static Check II

bool fd B : contained A int fd contains C c acquires int fd D : contained C C : contained B A bool fd contains B b contains D d

Environmental Acquisition Revisited — POPL 2005 – p.14/30

slide-20
SLIDE 20

Static Check II

bool fd B : contained A int fd contains C c acquires int fd D : contained C C : contained B A bool fd contains B b contains D d

  • acquires
✝ ✟

from

, and types are not compatible. Program is not well-typed.

Environmental Acquisition Revisited — POPL 2005 – p.14/30

slide-21
SLIDE 21

Design Decisions

Environmental Acquisition Revisited — POPL 2005 – p.15/30

slide-22
SLIDE 22

Running Example

... ... ... Prop1 meth(Property p) { ... } acquires Property fd acquires Property meth(Prop2) Prop1 Ctnr1 Prop2 Prop1 fd Property Property meth(Prop2 x) { ... } Ctnr2 Prop2 fd contains Item it contains Item it Item : contained Ctnr1, Ctnr2

Environmental Acquisition Revisited — POPL 2005 – p.16/30

slide-23
SLIDE 23

Acquisition by Value and by Name

anItem : Item acquires Property fd contains Item it aCtnr1 : Ctnr1 Prop1 fd contains Item it aCtnr2 : Ctnr2 Prop2 fd

When does

✆ ✝ ✆ ✄ ✞ ✚

acquire

✝ ✟

’s value?

Environmental Acquisition Revisited — POPL 2005 – p.17/30

slide-24
SLIDE 24

Acquisition by Value and by Name

anItem : Item acquires Property fd contains Item it aCtnr1 : Ctnr1 Prop1 fd contains Item it aCtnr2 : Ctnr2 Prop2 fd

When does

✆ ✝ ✆ ✄ ✞ ✚

acquire

✝ ✟

’s value?

  • By value: when
✆ ✝ ✆ ✄ ✞ ✚

is placed into

✆ ✠ ✄ ✝ ☞
  • .

Environmental Acquisition Revisited — POPL 2005 – p.17/30

slide-25
SLIDE 25

Acquisition by Value and by Name

anItem : Item acquires Property fd contains Item it aCtnr1 : Ctnr1 Prop1 fd contains Item it aCtnr2 : Ctnr2 Prop2 fd

When does

✆ ✝ ✆ ✄ ✞ ✚

acquire

✝ ✟

’s value?

  • By value: when
✆ ✝ ✆ ✄ ✞ ✚

is placed into

✆ ✠ ✄ ✝ ☞
  • .
  • By name: when
✆ ✝ ✆ ✄ ✞ ✚ ✑ ✝ ✟

is referenced.

Environmental Acquisition Revisited — POPL 2005 – p.17/30

slide-26
SLIDE 26

Acquisition by Value and by Name

anItem : Item acquires Property fd contains Item it aCtnr1 : Ctnr1 Prop1 fd contains Item it aCtnr2 : Ctnr2 Prop2 fd

When does

✆ ✝ ✆ ✄ ✞ ✚

acquire

✝ ✟

’s value?

  • By value: when
✆ ✝ ✆ ✄ ✞ ✚

is placed into

✆ ✠ ✄ ✝ ☞
  • .
  • By name: when
✆ ✝ ✆ ✄ ✞ ✚ ✑ ✝ ✟

is referenced. Both are sound; primarily affects visibility of assignments.

Environmental Acquisition Revisited — POPL 2005 – p.17/30

slide-27
SLIDE 27

Acquisition by Value and by Name

anItem : Item acquires Property fd contains Item it aCtnr1 : Ctnr1 Prop1 fd contains Item it aCtnr2 : Ctnr2 Prop2 fd

Two questions with acquisition-by-value:

Environmental Acquisition Revisited — POPL 2005 – p.18/30

slide-28
SLIDE 28

Acquisition by Value and by Name

anItem : Item acquires Property fd contains Item it aCtnr1 : Ctnr1 Prop1 fd contains Item it aCtnr2 : Ctnr2 Prop2 fd

Two questions with acquisition-by-value: 1.

✆ ✠ ✄ ✝ ☞
☎ ✄

:

  • null;
✆ ✝ ✆ ✄ ✞ ✚ ✑ ✝ ✟

: previous value or undefined?

Environmental Acquisition Revisited — POPL 2005 – p.18/30

slide-29
SLIDE 29

Acquisition by Value and by Name

anItem : Item acquires Property fd contains Item it aCtnr1 : Ctnr1 Prop1 fd contains Item it aCtnr2 : Ctnr2 Prop2 fd

Two questions with acquisition-by-value: 1.

✆ ✠ ✄ ✝ ☞
☎ ✄

:

  • null;
✆ ✝ ✆ ✄ ✞ ✚ ✑ ✝ ✟

: previous value or undefined? 2.

✆ ✠ ✄ ✝ ☞
☎ ✄

:

✝ ✆ ✄ ✞ ✚ ✏ ✆ ✝ ✆ ✄ ✞ ✚ ✑ ✝ ✟

: previous value, or value of

✆ ✠ ✄ ✝ ☞
✝ ✟

?

Environmental Acquisition Revisited — POPL 2005 – p.18/30

slide-30
SLIDE 30

Acquisition by Value and by Name

anItem : Item acquires Property fd contains Item it aCtnr1 : Ctnr1 Prop1 fd contains Item it aCtnr2 : Ctnr2 Prop2 fd

Two questions with acquisition-by-value: 1.

✆ ✠ ✄ ✝ ☞
☎ ✄

:

  • null;
✆ ✝ ✆ ✄ ✞ ✚ ✑ ✝ ✟

: previous value or undefined? 2.

✆ ✠ ✄ ✝ ☞
☎ ✄

:

✝ ✆ ✄ ✞ ✚ ✏ ✆ ✝ ✆ ✄ ✞ ✚ ✑ ✝ ✟

: previous value, or value of

✆ ✠ ✄ ✝ ☞
✝ ✟

? We implement acquisition-by-name; it avoids both issues.

Environmental Acquisition Revisited — POPL 2005 – p.18/30

slide-31
SLIDE 31

Type Variance in Acquisition

Property :> Prop2 Item : contained Ctnr1, ... contains Item it Property meth(Prop1 p) { ... } Prop1 fd acquires Property fd acquires Prop2 meth(Property) Ctnr1

Gil and Lorenz claim that the above program is type-safe, because of normal method-type co/contravariance.

Environmental Acquisition Revisited — POPL 2005 – p.19/30

slide-32
SLIDE 32

Type Variance in Acquisition

Prop1 <: Property Item : contained Ctnr1, ... contains Item it Property meth(Prop1 p) { ... } Prop1 fd acquires Property fd acquires Prop2 meth(Property) Ctnr1

Gil and Lorenz claim that the above program is type-safe, because of normal method-type co/contravariance.

Environmental Acquisition Revisited — POPL 2005 – p.19/30

slide-33
SLIDE 33

Type Variance in Acquisition

Property :> Prop2 Item : contained Ctnr1, ... contains Item it Property meth(Prop1 p) { ... } Prop1 fd acquires Property fd acquires Prop2 meth(Property) Ctnr1

Gil and Lorenz claim that the above program is type-safe, because of normal method-type co/contravariance.

Environmental Acquisition Revisited — POPL 2005 – p.19/30

slide-34
SLIDE 34

Type Variance in Acquisition

Property :> Prop2 Item : contained Ctnr1, ... contains Item it Property meth(Prop1 p) { ... } Prop1 fd acquires Property fd acquires Prop2 meth(Property) Ctnr1

Gil and Lorenz claim that the above program is type-safe, because of normal method-type co/contravariance. Unsafe!

Environmental Acquisition Revisited — POPL 2005 – p.19/30

slide-35
SLIDE 35

Type Variance in Acquisition

Property :> Prop2 Item : contained Ctnr1, ... contains Item it Property meth(Prop1 p) { ... } Prop1 fd acquires Property fd acquires Prop2 meth(Property) Ctnr1

Gil and Lorenz claim that the above program is type-safe, because of normal method-type co/contravariance. Unsafe! Co/contravariance don’t apply.

Environmental Acquisition Revisited — POPL 2005 – p.19/30

slide-36
SLIDE 36

Type Variance in Acquisition

Prop1 meth(Property p) { ... } acquires Property meth(Prop2) Ctnr1 Prop1 fd contains Item it Item : contained Ctnr1, ... acquires Property fd

Variance is still possible. Acquiring class may expect more general type.

Environmental Acquisition Revisited — POPL 2005 – p.20/30

slide-37
SLIDE 37

Assignment to Acquired Fields

anItem : Item acquires Property fd contains Item it aCtnr1 : Ctnr1 Prop1 fd Prop2

Environmental Acquisition Revisited — POPL 2005 – p.21/30

slide-38
SLIDE 38

Assignment to Acquired Fields

Prop2 anItem : Item acquires Property fd contains Item it aCtnr1 : Ctnr1 Prop1 fd

In a naïve system, anItem.fd :

  • new Prop2

type-checks.

Environmental Acquisition Revisited — POPL 2005 – p.21/30

slide-39
SLIDE 39

Assignment to Acquired Fields

anItem : Item acquires Property fd contains Item it aCtnr1 : Ctnr1 Prop1 fd Prop2

In a naïve system, anItem.fd :

  • new Prop2

type-checks. But

✆ ✝ ✆ ✄ ✞ ✚ ✑ ✝ ✟

is an alias to

✆ ✠ ✄ ✝ ☞
✝ ✟

.

Environmental Acquisition Revisited — POPL 2005 – p.21/30

slide-40
SLIDE 40

Assignment to Acquired Fields

anItem : Item acquires Property fd contains Item it aCtnr1 : Ctnr1 Prop1 fd Prop2

In a naïve system, anItem.fd :

  • new Prop2

type-checks. But

✆ ✝ ✆ ✄ ✞ ✚ ✑ ✝ ✟

is an alias to

✆ ✠ ✄ ✝ ☞
✝ ✟

. Unsafe:

✆ ✠ ✄ ✝ ☞
✝ ✟

is no longer a

☎ ☞ ✂ ✖
  • .

Environmental Acquisition Revisited — POPL 2005 – p.21/30

slide-41
SLIDE 41

Assignment to Acquired Fields

Three possible solutions:

  • 1. Forbid subsumption on the right-hand side of

assignments to acquired fields.

Environmental Acquisition Revisited — POPL 2005 – p.22/30

slide-42
SLIDE 42

Assignment to Acquired Fields

Three possible solutions:

  • 1. Forbid subsumption on the right-hand side of

assignments to acquired fields. Introduces bad asymmetry into language.

Environmental Acquisition Revisited — POPL 2005 – p.22/30

slide-43
SLIDE 43

Assignment to Acquired Fields

Three possible solutions:

  • 1. Forbid subsumption on the right-hand side of

assignments to acquired fields. Introduces bad asymmetry into language.

  • 2. Forbid type variance for acquired fields.

Environmental Acquisition Revisited — POPL 2005 – p.22/30

slide-44
SLIDE 44

Assignment to Acquired Fields

Three possible solutions:

  • 1. Forbid subsumption on the right-hand side of

assignments to acquired fields. Introduces bad asymmetry into language.

  • 2. Forbid type variance for acquired fields.

Too inflexible.

Environmental Acquisition Revisited — POPL 2005 – p.22/30

slide-45
SLIDE 45

Assignment to Acquired Fields

Three possible solutions:

  • 1. Forbid subsumption on the right-hand side of

assignments to acquired fields. Introduces bad asymmetry into language.

  • 2. Forbid type variance for acquired fields.

Too inflexible.

  • 3. Forbid assignment to acquired fields.

Environmental Acquisition Revisited — POPL 2005 – p.22/30

slide-46
SLIDE 46

Assignment to Acquired Fields

Three possible solutions:

  • 1. Forbid subsumption on the right-hand side of

assignments to acquired fields. Introduces bad asymmetry into language.

  • 2. Forbid type variance for acquired fields.

Too inflexible.

  • 3. Forbid assignment to acquired fields.

Jacques implements option 3: right balance between flexibility and safety.

Environmental Acquisition Revisited — POPL 2005 – p.22/30

slide-47
SLIDE 47

Changing Containers

anItem : Item acquires Property fd contains Item it aCtnr1 : Ctnr1 Prop1 fd contains Item it aCtnr2 : Ctnr2 Prop2 fd

Environmental Acquisition Revisited — POPL 2005 – p.23/30

slide-48
SLIDE 48

Changing Containers

anItem : Item acquires Property fd contains Item it aCtnr1 : Ctnr1 Prop1 fd contains Item it aCtnr2 : Ctnr2 Prop2 fd

Assignment

✆ ✠ ✄ ✝ ☞
☎ ✄

:

✝ ✆ ✄ ✞ ✚

automatically updates hidden parent ref.

Environmental Acquisition Revisited — POPL 2005 – p.23/30

slide-49
SLIDE 49

Changing Containers

anItem : Item acquires Property fd contains Item it aCtnr1 : Ctnr1 Prop1 fd contains Item it aCtnr2 : Ctnr2 Prop2 fd

Assignment

✆ ✠ ✄ ✝ ☞
☎ ✄

:

✝ ✆ ✄ ✞ ✚

automatically updates hidden parent ref. Can change existing containment tree: aCtnr2.it :

  • anItem.

Violates two-way reference invariant.

Environmental Acquisition Revisited — POPL 2005 – p.23/30

slide-50
SLIDE 50

Changing Containers

anItem : Item acquires Property fd contains Item it aCtnr1 : Ctnr1 Prop1 fd contains Item it aCtnr2 : Ctnr2 Prop2 fd

Assignment

✆ ✠ ✄ ✝ ☞
☎ ✄

:

✝ ✆ ✄ ✞ ✚

automatically updates hidden parent ref. Can change existing containment tree: aCtnr2.it :

  • anItem.

Violates two-way reference invariant. So we forbid this assignment.

Environmental Acquisition Revisited — POPL 2005 – p.23/30

slide-51
SLIDE 51

Forwarding and Delegation

Item : contained Ctnr1, ... acquires Property fd acquires Property meth(Prop2) Ctnr1 Prop1 fd contains Item it Prop1 meth(Property p) { ... }

What is this when executing acquired method

✆ ✝ ✆ ✄ ✞ ✚ ✑ ✚ ✞ ✄
✑ ✑ ✑ ✕

?

  • Delegation: this refers to acquiring object (
✆ ✝ ✆ ✄ ✞ ✚

)

  • Forwarding: this refers to providing object (
✆ ✠ ✄ ✝ ☞
  • )

Environmental Acquisition Revisited — POPL 2005 – p.24/30

slide-52
SLIDE 52

Forwarding and Delegation

Item : contained Ctnr1, ... acquires Property fd acquires Property meth(Prop2) Ctnr1 Prop1 fd contains Item it Prop1 meth(Property p) { ... }

What is this when executing acquired method

✆ ✝ ✆ ✄ ✞ ✚ ✑ ✚ ✞ ✄
✑ ✑ ✑ ✕

?

  • Delegation: this refers to acquiring object (
✆ ✝ ✆ ✄ ✞ ✚

)

  • Forwarding: this refers to providing object (
✆ ✠ ✄ ✝ ☞
  • )

Delegation unsafe: body of

✠ ✄ ✝ ☞
✚ ✞ ✄
  • type-checked under

assumption that this : Ctnr1.

Environmental Acquisition Revisited — POPL 2005 – p.24/30

slide-53
SLIDE 53

Type Soundness

Environmental Acquisition Revisited — POPL 2005 – p.25/30

slide-54
SLIDE 54

Jacques Soundness

If program P has type t, then evaluating P has one of the following results:

  • The result is an object reference with the right type, or
  • The result is null, or
  • The program diverges, or
  • The program halts with an error:
  • dereferenced null
  • bad cast

Environmental Acquisition Revisited — POPL 2005 – p.26/30

slide-55
SLIDE 55

Jacques Soundness

If program P has type t, then evaluating P has one of the following results:

  • The result is an object reference with the right type, or
  • The result is null, or
  • The program diverges, or
  • The program halts with an error:
  • dereferenced null
  • bad cast
  • incomplete context
  • bject already contained
  • container cycle

Environmental Acquisition Revisited — POPL 2005 – p.26/30

slide-56
SLIDE 56

Conclusions

Environmental Acquisition Revisited — POPL 2005 – p.27/30

slide-57
SLIDE 57

Contributions

We have placed demonstrated acquisition’s technical feasibility and placed it on a firm theoretical foundation.

  • We developed a formal model for reasoning about

acquisition in the context of a Java-like language.

  • We used the formal model to re-examine Gil & Lorenz’s

conclusions about type safety.

  • We explored the interactions between acquisition and

assignment.

Environmental Acquisition Revisited — POPL 2005 – p.28/30

slide-58
SLIDE 58

Future Work

  • Wider range of examples of acquisition.
  • Practical experience: implement this and use it.
  • More advanced type systems:
  • Can we infer list of possible containers for a class?
  • Can a resource-aware type system ensure that the

“incomplete context” exception is never generated?

Environmental Acquisition Revisited — POPL 2005 – p.29/30

slide-59
SLIDE 59

Related Work

Ownership types (Clarke et al):

Environmental Acquisition Revisited — POPL 2005 – p.30/30

slide-60
SLIDE 60

Related Work

Ownership types (Clarke et al):

  • Also constrain object containment—to limit object

aliasing

Environmental Acquisition Revisited — POPL 2005 – p.30/30

slide-61
SLIDE 61

Related Work

Ownership types (Clarke et al):

  • Also constrain object containment—to limit object

aliasing

  • Could help us ensure no object has multiple containers

Environmental Acquisition Revisited — POPL 2005 – p.30/30

slide-62
SLIDE 62

Related Work

Ownership types (Clarke et al):

  • Also constrain object containment—to limit object

aliasing

  • Could help us ensure no object has multiple containers
  • But resulting constraints on aliasing too restrictive

Environmental Acquisition Revisited — POPL 2005 – p.30/30

slide-63
SLIDE 63

Related Work

Ownership types (Clarke et al):

  • Also constrain object containment—to limit object

aliasing

  • Could help us ensure no object has multiple containers
  • But resulting constraints on aliasing too restrictive
  • Cannot statically prevent “incomplete context”

exceptions

Environmental Acquisition Revisited — POPL 2005 – p.30/30

slide-64
SLIDE 64

Thank you.

cobbe@ccs.neu.edu

Environmental Acquisition Revisited — POPL 2005 – p.31/30