Getting F-Bounded Polymorphism into Shape Ben Greenman, Fabian

Getting F-Bounded Polymorphism into Shape Ben Greenman, Fabian

Getting F-Bounded Polymorphism into Shape Ben Greenman, Fabian Muehlboeck, and Ross Tate Cornell University Typesafe Equality + Generic Lists? (Typesafe) Equality @override

public boolean equals(Object other) { if(other instanceof String){} else { return false; } } Hello.equals(5) (Typesafe) Equality interface Eq { boolean equalTo(T other);

} class String extends Eq { boolean equalTo(String other) {} } Hello.equalTo(5) (Typesafe) Equality

{Hello,World!} .equalTo {Ahoi,World!} {inc,} .equalTo {,id} List (read-only) Eq

List Eq List Eq List

contravariant :> :> covariant Eq

interface List extends Eq>> interface List extends Eq>> List <: Eq>

Eq <: Eq> Eq> Eq >> >> List List <: > List>

> Strin Eq g > Done! Ross Tate, Alan Leung,

and SorinC.Lerner Andrew J. Kennedy and Benjamin Pierce Taming in Java's Type , PLDI 2011 On Decidability

ofWildcards Nominal Subtyping withSystem Variance, FOOL-WOOD 2007 List extends Nested

Contravariance! Eq> > List List> List extends Eq>> extends Eq> Expansive

Inheritance! > Trees class Tree extends List Are trees equatable? Are Trees equatable? Are Trees equatable?

Tree <: List> List List <: List> List> Tree Tree <: <: Eq Eq List <:

Eq List <: Eq Eq>> <: Eq Eq>> Eq>> <: Eq Eq Tree <: List> Tree Tree <: List> List>

Meh! interface List extends Eq>> WHY?

interface List extends List> Eq>> How do we use Eq<>? as type arguments! List

List> WithNOT F-bounded polymorphism! classNOT String extends Eq for parameters! class Set

extends Eq> NOT for return types! NOT for fields! NOT for local variables! Shapes

Used in Recursive inheritance definitions Recursive type variable constraints Eq Comparable Clonable Summable

Materials Used for Type arguments

Method parameters Return types Fields Variables String List Throwable FileStream

All Sheep in Scotland are black Read these 13 million lines of Code! Can I script it? NO! I mean YES! Survey 13.5 million lines of open-source generic Java code

from 60 projects taken primarily from the Qualitas Corpus* No class was ever both a shape and a material Recursive - inheritance definitions - type variable constraints *http://qualitascorpus.com - Type arguments

- Method parameters - Return types - Fields & Variables Material-Shape Separation Thou shalt not mix shapes and materials!

Shapes Used in Recursive inheritance definitions Recursive type variable constraints Recursive inheritance only through Shapes

Materials Used for Type arguments Method parameters Fields

Variables Well-founded inheritance Well-founded Material Inheritance Materials class A extends B, D {} Inheritance hierarchies defined

independent of A Well-founded Material Inheritance class A extends B {} class B extends A {} class A extends List {} class B extends List {} Decidable Subtyping

With nave algorithms Proven with a simple measure Decidable Subtyping material interface Pred material interface Matrix extends List> Pred> <: Pred> Matrix <: List

List> <: List Decidable Subtyping Pred> <: Pred> Matrix <: List List> <: List List <: Object Done!

Decidable Subtyping Pred> < Pred> Matrix < List : List> < List :

List < Object : Decidable Subtyping A extends B> max { | | ||

| |= 1+ | | | | {||(||( ) ) ||( ) =1+max Inheritance well-founded measure function terminates

Decidable Subtyping A extends Eq>> A < > <: Eq < > h No Shapes

in here E q < A < List < >>> <: Eq < > All Materials <: A < List < >>

Joins Most precise common supertype String Integer = ?

someBool ? 42 : Hello Joins Integer extends Clonable String extends Clonable String Integer = ? Clonable

Clonable> Clonable>> Computable Material Joins Integer extends Clonable String extends Clonable String Integer = ?

someBool ? 42 : Hello Materials only: Object MaterialA extends C Joins B extends C> A<>

B<> h C<> C>

Finite due to C<> well-founded material inheritance Recursion on and E<> Higher Kinds Conditional Inheritance

Computable Joins Decidable Subtyping Higher Kinds Material-Shape Separation

Recently Viewed Presentations

  • Buddhist Festivals and Milestones

    Buddhist Festivals and Milestones

    Visakha Puja Day. Full moon of May. Believed to be day of birth, enlightenment and death of Buddha. People gather at monasteries with flowers, candles and incense while reciting the 3 refuges
  • Marketing Workshop - Australian Library and Information ...

    Marketing Workshop - Australian Library and Information ...

    marketing workshop. diane velasquez, university of south australia jennifer campbell-meier, victoria university of wellington. 30 july 2018
  • Recordkeeping - Virginia Department of Health

    Recordkeeping - Virginia Department of Health

    Recordkeeping . Training Objectives. Describe the types of records that . ... Planning Cycle Menus lesson in the . ... **Institutions may not meet the 25% requirement by combining the number of enrollees who qualify under Title XX with the...
  • St. Michael&#x27;s Powerpoint template

    St. Michael's Powerpoint template

    Meffe, Filomena Ministry of Health and Long Term Care $27,755 2019 - 2021 Title: "Resident perceptions of midwifery in obstetrical care: Just in time inter-professional education" Montalban, Xavier Biogen MA Inc. $180,000 2019 - 2027 Title: "A randomized, controlled, open-label,...
  • MAVERICK LEADERSHIP UNLIMITED eCD Afrika PROJECT MANAGEMENT VANI

    MAVERICK LEADERSHIP UNLIMITED eCD Afrika PROJECT MANAGEMENT VANI

    A project management appraisal should be viewed as a useful, constructive and necessary diagnostic tool available for augmenting the capability of the sponsoring organization's project management team Project Management Appraisal PMA can therefore be used to: Identify the strengths of...
  • EFI Fiery, Digital StoreFront, Self-Serve: California State ...

    EFI Fiery, Digital StoreFront, Self-Serve: California State ...

    Cal State Fullerton Digital Print Services. California State University. Results. Integrated workflow improved turnaround times and number of jobs produced. The EFI M500 provides information to manage a copier operation.
  • Introduction to Software Engineering

    Introduction to Software Engineering

    Software Quality Assurance. Software quality assurance consists of a means of monitoring the software engineering processes and methods used to ensure quality. Every software developers will agree that high-quality software is an important goal.
  • Working in Aging Services - MemberClicks

    Working in Aging Services - MemberClicks

    People rely on their caregivers to cook and prepare food, to provide medical care, companionship and support. These are services that cannot be easily replaced by technology. This means that investing and staying within the field of aging services is...