Context: Trait composition has inspired new research in the area of code reuse for object oriented (OO) languages. One of the main advantages of this kind of composition is that it makes possible to separate subtyping from subclassing; which is good for code-reuse, design and reasoning. However, handling of state within traits is difficult, verbose or inelegant.
Inquiry: We identify the this-leaking problem as the fundamental limitation that prevents the separation of subtyping from subclassing in conventional OO languages. We explain that the concept of trait composition addresses this problem, by distinguishing code designed for use (as a type) from code designed for reuse (i.e. inherited). We are aware of at least 3 concrete independently designed research languages following this methodology: TraitRecordJ, Package Templates and DeepFJig.
Approach: In this paper, we design 42µ, a new language, where we improve use and reuse and support the This type and family polymorphism by distinguishing code designed for use from code designed for reuse. In this way 42µ synthesise the 3 approaches above, and improves them with abstract state operations: a new elegant way to handle state composition in trait based languages.
Knowledge and Grounding: Using case studies, we show that 42µ’s model of traits with abstract state operations is more usable and compact than prior work. We formalise our work and prove that type errors cannot arise from composing well typed code.
Importance: This work is the logical core of the programming language 42. This shows that the ideas presented in this paper can be applicable to a full general purpose language. This form of composition is very flexible and could be used in many new languages.
Wed 3 Apr Times are displayed in time zone: (GMT+02:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna change
|11:00 - 11:30|
Hrshikesh Arora, Marco ServettoVictoria University Wellington, New Zealand, Bruno C. d. S. OliveiraThe University of Hong Kong, Hong KongLink to publication DOI Pre-print
|11:30 - 12:00|
Paulius JuodisiusIT University of Copenhagen, Denmark, Atrisha SarkarUniversity of Waterloo, Canada, Raghava Rao MukkamalaDepartment of Technology, Kristiania University College, Norway, Michal AntkiewiczUniversity of Waterloo, Canada, Krzysztof CzarneckiUniversity of Waterloo, Canada, Andrzej WąsowskiIT University of Copenhagen, DenmarkLink to publication DOI Pre-print
|12:00 - 12:30|
Weixin ZhangThe University of Hong Kong, Hong Kong, Bruno C. d. S. OliveiraThe University of Hong Kong, Hong KongLink to publication DOI Pre-print