Essentials of Scala

نویسنده

  • Martin Odersky
چکیده

Languages like Scala fuse object-oriented programming with concepts from module systems. Like an ML module, an object can have types as members. This poses new challenges for the type theoretic foundation of these languages. Instead of a stratified solution à la ML, we are looking for a system that does not distinguish between core language and module system. In this talk I'll present a new type-system that can model Scala and languages like it. The properties we are interested in are Scala's path-dependent types and abstract type members, as well as its mixture of nominal and structural typing through the use of refinement types. Compared to previous approaches, we make no attempt to model inheritance or mixin composition. Indeed we will argue that such concepts are better expressed in a different setting. The calculus does not precisely describe what's currently in Scala. It is more normative than descriptive. The main point of deviation concerns the difference between Scala's compound type formation using with and classical type intersection, as it is modelled in the calculus. Scala, and the previous calculi attempting to model it conflates the concepts of compound types (which inherit the members of several parent types) and mixin composition (which build classes from other classes and traits). At first glance, this offers an economy of concepts. However , it is problematic because mixin composition and intersection types have quite different properties. In the case of several inherited members with the same name, mixin composition has to pick one which overrides the others. It uses for that the concept of a linearization of a trait hierarchy. Typically, given two independent traits with a common method, the mixin composition of those traits would favor the method definition in the second trait, whereas the member in the first trait would be accessible with a super-call. All this makes sense from an implementation standpoint. From a typing standpoint it is more awkward, because it breaks commutativity and with it several monotonicity properties. In the proposed calculus, we replace Scala's compound types by classical intersection types, which are commutative. We also complement this by classical union types. Intersections and unions form a lattice wrt subtyping. This addresses another problematic feature of Scala's current type system, where least upper bounds and greatest lower bounds do not always exist.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Teaching Minimum Learning Essentials to Orthopedic Interns in Isfahan University of Medical Sciences

Introduction: The prevalence of musculoskeletal and orthopedic diseases is high in outpatient visits and emergency ward. Meanwhile, evidences show that there is no appropriate and sufficient education in this regard, in the educational programs of medical students and especially orthopedic interns. The aim of this study was to determine the accomplishment of minimum learning essentials by inter...

متن کامل

Pre- requisites and essentials for accreditation in Iran Medical Education System

Introduction. Accreditation has a long antecedence in western countries educational systems and its history of implementation is more than a century in a country such as United States of America. In European countries, also different activities have been implied throughout the accreditation and its implementation has become an essential. Now, in our country the experts also think of the accredi...

متن کامل

rscala: Integration of R and Scala

This paper introduces the rscala package for the statistical software R. This package provides a two-way bridge between R and Scala enabling a user to exploit each language’s respective strengths in a single project. The rscala package transparently brings Scala and Java methods into R as if they were native R functions. Specifically, Scala classes can be instantiated and methods of Scala class...

متن کامل

SCALA: A Framework for Performance Evaluation of Scalable Computing

Conventional performance environments are based on pro ling and event instrumentation. It becomes problematic as parallel systems scale to hundreds of nodes and beyond. A framework of developing an integrated performance modeling and prediction system, SCALability Analyzer (SCALA), is presented in this study. In contrast to existing performance tools, the program performance model generated by ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2009