Swift Documentation Release 2.2

Total Page:16

File Type:pdf, Size:1020Kb

Swift Documentation Release 2.2 Swift Documentation Release 2.2 LLVM project 2017-11-11 Contents 1 Index Invalidation Rules in the Swift Standard Library1 2 Access Control 5 3 Driver Design & Internals 9 4 Parseable Driver Output 13 5 Error Handling in Swift 2.0 17 6 Error Handling Rationale and Proposal 29 7 Generics in Swift 55 8 Logical Objects 69 9 Object Initialization 71 10 Pattern Matching 83 11 Stored and Computed Variables 95 12 Swift Intermediate Language (SIL) 101 13 Type Checker Design and Implementation 173 14 Debugging the Swift Compiler 187 i ii CHAPTER 1 Index Invalidation Rules in the Swift Standard Library 1.1 Points to consider 1. Collections can be implemented as value types or a reference types. 2. Copying an instance of a value type, or copying a reference has well-defined semantics built into the language and is not controllable by the user code. Consequence: value-typed collections in Swift have to use copy-on-write for data stored out-of-line in reference- typed buffers. 3. We want to be able to pass/return a Collection along with its indices in a safe manner. In Swift, unlike C++, indices are not sufficient to access collection data; one needs an index and a collection. Thus, merely passing a collection by value to a function should not invalidate indices. 1.2 General principles In C++, validity of an iterator is a property of the iterator itself, since iterators can be dereferenced to access collection elements. In Swift, in order to access a collection element designated by an index, subscript operator is applied to the collection, C[I]. Thus, index is valid or not only in context of a certain collection instance at a certain point of program execution. A given index can be valid for zero, one or more than one collection instance at the same time. An index that is valid for a certain collection designates an element of that collection or represents a one-past-end index. Operations that access collection elements require valid indexes (this includes accessing using the subscript operator, slicing, swapping elements, removing elements etc.) Using an invalid index to access elements of a collection leads to unspecified memory-safe behavior. (Possibilities include trapping, performing the operation on an arbitrary element of this or any other collection etc.) Concrete collection types can specify behavior; implementations are advised to perform a trap. 1 Swift Documentation, Release 2.2 An arbitrary index instance is not valid for an arbitrary collection instance. The following points apply to all collections, defined in the library or by the user: 1. Indices obtained from a collection C via C.startIndex, C.endIndex and other collection-specific APIs returning indices, are valid for C. 2. If an index I is valid for a collection C, a copy of I is valid for C. 3. If an index I is valid for a collection C, indices obtained from I via I.successor(), I.predecessor(), and other index-specific APIs, are valid for C. FIXME: disallow startIndex.predecessor(), endIndex.successor() 4. Indices of collections and slices freely interoperate. If an index I is valid for a collection C, it is also valid for slices of C, provided that I was in the bounds that were passed to the slicing subscript. If an index I is valid for a slice obtained from a collection C, it is also valid for C itself. 5. If an index I is valid for a collection C, it is also valid for a copy of C. 6. If an index I is valid for a collection C, it continues to be valid after a call to a non-mutating method on C. 7. Calling a non-mutating method on a collection instance does not invalidate any indexes. 8. Indices behave as if they are composites of offsets in the underlying data structure. For example: • an index into a set backed by a hash table with open addressing is the number of the bucket where the element is stored; • an index into a collection backed by a tree is a sequence of integers that describe the path from the root of the tree to the leaf node; • an index into a lazy flatMap collection consists of a pair of indices, an index into the base collection that is being mapped, and the index into the result of mapping the element designated by the first index. This rule does not imply that indices should be cheap to convert to actual integers. The offsets for consecutive elements could be non-consecutive (e.g., in a hash table with open addressing), or consist of multiple offsets so that the conversion to an integer is non-trival (e.g., in a tree). Note that this rule, like all other rules, is an “as if” rule. As long as the resulting semantics match what the rules dictate, the actual implementation can be anything. Rationale and discussion: • This rule is mostly motivated by its consequences, in particular, being able to mutate an element of a collection without changing the collection’s structure, and, thus, without invalidating indices. • Replacing a collection element has runtime complexity O(1) and is not considered a structural mutation. Therefore, there seems to be no reason for a collection model would need to invalidate indices from the implementation point of view. • Iterating over a collection and performing mutations in place is a common pattern that Swift’s collection library needs to support. If replacing individual collection elements would invalidate indices, many com- mon algorithms (like sorting) wouldn’t be implementable directly with indices; the code would need to maintain its own shadow indices, for example, plain integers, that are not invalidated by mutations. Consequences: • The setter of MutableCollection.subscript(_: Index) does not invalidate any indices. Indices are composites of offsets, so replacing the value does not change the shape of the data structure and preserves offsets. • A value type mutable linked list can not conform to MutableCollectionType. An index for a linked list has to be implemented as a pointer to the list node to provide O(1) element access. Mutating an element of a 2 Chapter 1. Index Invalidation Rules in the Swift Standard Library Swift Documentation, Release 2.2 non-uniquely referenced linked list will create a copy of the nodes that comprise the list. Indices obtained before the copy was made would point to the old nodes and wouldn’t be valid for the copy of the list. It is still valid to have a value type linked list conform to CollectionType, or to have a reference type mutable linked list conform to MutableCollection. The following points apply to all collections by default, but specific collection implementations can be less strict: 1. A call to a mutating method on a collection instance, except the setter of MutableCollection. subscript(_: Index), invalidates all indices for that collection instance. Consequences: • Passing a collection as an inout argument invalidates all indexes for that collection instance, unless the func- tion explicitly documents stronger guarantees. (The function can call mutating methods on an inout argument or completely replace it.) – Swift.swap() does not invalidate any indexes. 1.3 Additional guarantees for Swift.Array, Swift. ContiguousArray, Swift.ArraySlice Valid array indexes can be created without using Array APIs. Array indexes are plain integers. Integers that are dynamically in the range 0..<A.count are valid indexes for the array or slice A. It does not matter if an index was obtained from the collection instance, or derived from input or unrelated data. Traps are guaranteed. Using an invalid index to designate elements of an array or an array slice is guaranteed to perform a trap. 1.4 Additional guarantees for Swift.Dictionary Insertion into a Dictionary invalidates indexes only on a rehash. If a Dictionary has enough free buckets (guaranteed by calling an initializer or reserving space), then inserting elements does not invalidate indexes. Note: unlike C++’s std::unordered_map, removing elements from a Dictionary invalidates indexes. 1.3. Additional guarantees for Swift.Array, Swift.ContiguousArray, Swift.ArraySlice 3 Swift Documentation, Release 2.2 4 Chapter 1. Index Invalidation Rules in the Swift Standard Library CHAPTER 2 Access Control The general guiding principle of Swift access control: No entity can be defined in terms of another entity that has a lower access level. There are three levels of access: “private”, “internal”, and “public”. Private entities can only be accessed from within the source file where they are defined. Internal entities can be accessed anywhere within the module they are defined. Public entities can be accessed from anywhere within the module and from any other context that imports the current module. The names public and private have precedent in many languages; internal comes from C#. In the future, public may be used for both API and SPI, at which point we may design additional annotations to distinguish the two. By default, most entities in a source file have internal access. This optimizes for the most common case—a single-target application project—while not accidentally revealing entities to clients of a framework module. • Rules – Globals and Members – Protocols – Structs, Enums, and Classes – Types • Runtime Guarantees – Interaction with Objective-C • Non-Goals: “class-only” and “protected” • Potential Future Directions 5 Swift Documentation, Release 2.2 2.1 Rules Access to a particular entity is considered relative to the current access context. The access context of an entity is the current file (if private), the current module (if internal), or the current program (if public). A reference to an entity may only be written within the entity’s access context.
Recommended publications
  • Operating System Engineering, Lecture 3
    6.828 2012 Lecture 3: O/S Organization plan: O/S organization processes isolation topic: overall o/s design what should the main components be? what should the interfaces look like? why have an o/s at all? why not just a library? then apps are free to use it, or not -- flexible some tiny O/Ss for embedded processors work this way key requirement: support multiple activities multiplexing isolation interaction helpful approach: abstract services rather than raw hardware file system, not raw disk TCP, not raw ethernet processes, not raw CPU/memory abstractions often ease multiplexing and interaction and more convenient and portable note: i'm going to focus on mainstream designs (xv6, Linux, &c) for *every* aspect, someone has done it a different way! example: exokernel and VMM does *not* abstract anything! xv6 has only a few abstractions / services processes (cpu, mem) I/O (file descriptors) file system i'm going to focus on xv6 processes today a process is a running program it has its own memory, share of CPU, FDs, parent, children, &c it uses system calls to interact outside itself to get at kernel services xv6 basic design here very traditional (UNIX/Linux/&c) xv6 user/kernel organization h/w, kernel, user kernel is a big program services: process, FS, net low-level: devices, VM all of kernel runs w/ full hardware privilege (very convenient) system calls switch between user and kernel 1 good: easy for sub-systems to cooperate (e.g. paging and file system) bad: interactions => complex, bugs are easy, no isolation within o/s called "monolithic";
    [Show full text]
  • Higher-Order Functions 15-150: Principles of Functional Programming – Lecture 13
    Higher-order Functions 15-150: Principles of Functional Programming { Lecture 13 Giselle Reis By now you might feel like you have a pretty good idea of what is going on in functional program- ming, but in reality we have used only a fragment of the language. In this lecture we see what more we can do and what gives the name functional to this paradigm. Let's take a step back and look at ML's typing system: we have basic types (such as int, string, etc.), tuples of types (t*t' ) and functions of a type to a type (t ->t' ). In a grammar style (where α is a basic type): τ ::= α j τ ∗ τ j τ ! τ What types allowed by this grammar have we not used so far? Well, we could, for instance, have a function below a tuple. Or even a function within a function, couldn't we? The following are completely valid types: int*(int -> int) int ->(int -> int) (int -> int) -> int The first one is a pair in which the first element is an integer and the second one is a function from integers to integers. The second one is a function from integers to functions (which have type int -> int). The third type is a function from functions to integers. The two last types are examples of higher-order functions1, i.e., a function which: • receives a function as a parameter; or • returns a function. Functions can be used like any other value. They are first-class citizens. Maybe this seems strange at first, but I am sure you have used higher-order functions before without noticing it.
    [Show full text]
  • The Design of a Pascal Compiler Mohamed Sharaf, Devaun Mcfarland, Aspen Olmsted Part I
    The Design of A Pascal Compiler Mohamed Sharaf, Devaun McFarland, Aspen Olmsted Part I Mohamed Sharaf Introduction The Compiler is for the programming language PASCAL. The design decisions Concern the layout of program and data, syntax analyzer. The compiler is written in its own language. The compiler is intended for the CDC 6000 computer family. CDC 6000 is a family of mainframe computer manufactured by Control Data Corporation in the 1960s. It consisted of CDC 6400, CDC 6500, CDC 6600 and CDC 6700 computers, which all were extremely rapid and efficient for their time. It had a distributed architecture and was a reduced instruction set (RISC) machine many years before such a term was invented. Pascal Language Imperative Computer Programming Language, developed in 1971 by Niklaus Wirth. The primary unit in Pascal is the procedure. Each procedure is represented by a data segment and the program/code segment. The two segments are disjoint. Compiling Programs: Basic View Machine Pascal languag program Pascal e compile program filename . inpu r gp output a.out p t c Representation of Data Compute all the addresses at compile time to optimize certain index calculation. Entire variables always are assigned at least one full PSU “Physical Storage Unit” i.e CDC6000 has ‘wordlength’ of 60 bits. Scalar types Array types the first term is computed by the compiler w=a+(i-l)*s Record types: reside only within one PSU if it is represented as packed. If it is not packed its size will be the size of the largest possible variant. Data types … Powerset types The set operations of PASCAL are realized by the conventional bit-parallel logical instructions ‘and ‘ for intersection, ‘or’ for union File types The data transfer between the main store buffer and the secondary store is performed by a Peripheral Processor (PP).
    [Show full text]
  • Typescript Language Specification
    TypeScript Language Specification Version 1.8 January, 2016 Microsoft is making this Specification available under the Open Web Foundation Final Specification Agreement Version 1.0 ("OWF 1.0") as of October 1, 2012. The OWF 1.0 is available at http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0. TypeScript is a trademark of Microsoft Corporation. Table of Contents 1 Introduction ................................................................................................................................................................................... 1 1.1 Ambient Declarations ..................................................................................................................................................... 3 1.2 Function Types .................................................................................................................................................................. 3 1.3 Object Types ...................................................................................................................................................................... 4 1.4 Structural Subtyping ....................................................................................................................................................... 6 1.5 Contextual Typing ............................................................................................................................................................ 7 1.6 Classes .................................................................................................................................................................................
    [Show full text]
  • Scala Tutorial
    Scala Tutorial SCALA TUTORIAL Simply Easy Learning by tutorialspoint.com tutorialspoint.com i ABOUT THE TUTORIAL Scala Tutorial Scala is a modern multi-paradigm programming language designed to express common programming patterns in a concise, elegant, and type-safe way. Scala has been created by Martin Odersky and he released the first version in 2003. Scala smoothly integrates features of object-oriented and functional languages. This tutorial gives a great understanding on Scala. Audience This tutorial has been prepared for the beginners to help them understand programming Language Scala in simple and easy steps. After completing this tutorial, you will find yourself at a moderate level of expertise in using Scala from where you can take yourself to next levels. Prerequisites Scala Programming is based on Java, so if you are aware of Java syntax, then it's pretty easy to learn Scala. Further if you do not have expertise in Java but you know any other programming language like C, C++ or Python, then it will also help in grasping Scala concepts very quickly. Copyright & Disclaimer Notice All the content and graphics on this tutorial are the property of tutorialspoint.com. Any content from tutorialspoint.com or this tutorial may not be redistributed or reproduced in any way, shape, or form without the written permission of tutorialspoint.com. Failure to do so is a violation of copyright laws. This tutorial may contain inaccuracies or errors and tutorialspoint provides no guarantee regarding the accuracy of the site or its contents including this tutorial. If you discover that the tutorialspoint.com site or this tutorial content contains some errors, please contact us at [email protected] TUTORIALS POINT Simply Easy Learning Table of Content Scala Tutorial ..........................................................................
    [Show full text]
  • Entry Point Specification
    EMV® Contactless Specifications for Payment Systems Book B Entry Point Specification Version 2.6 July 2016 © 2016 EMVCo, LLC. All rights reserved. Reproduction, distribution and other use of this document is permitted only pursuant to the applicable agreement between the user and EMVCo found at www.emvco.com. EMV® is a registered trademark or trademark of EMVCo, LLC in the United States and other countries. EMV Contactless Book B Entry Point Specification version 2.6 Legal Notice The EMV® Specifications are provided “AS IS” without warranties of any kind, and EMVCo neither assumes nor accepts any liability for any errors or omissions contained in these Specifications. EMVCO DISCLAIMS ALL REPRESENTATIONS AND WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT, AS TO THESE SPECIFICATIONS. EMVCo makes no representations or warranties with respect to intellectual property rights of any third parties in or in relation to the Specifications. EMVCo undertakes no responsibility to determine whether any implementation of the EMV® Specifications may violate, infringe, or otherwise exercise the patent, copyright, trademark, trade secret, know-how, or other intellectual property rights of third parties, and thus any person who implements any part of the EMV® Specifications should consult an intellectual property attorney before any such implementation. Without limiting the foregoing, the Specifications may provide for the use of public key encryption and other technology, which may be the subject matter of patents in several countries. Any party seeking to implement these Specifications is solely responsible for determining whether its activities require a license to any such technology, including for patents on public key encryption technology.
    [Show full text]
  • Smalltalk Smalltalk
    3/8/2008 CSE 3302 Programming Languages Smalltalk Everyygthing is obj ect. Obj ects communicate by messages. Chengkai Li Spring 2008 Lecture 14 – Smalltalk, Spring Lecture 14 – Smalltalk, Spring CSE3302 Programming Languages, UT-Arlington 1 CSE3302 Programming Languages, UT-Arlington 2 2008 ©Chengkai Li, 2008 2008 ©Chengkai Li, 2008 Object Hierarchy Object UndefinedObject Boolean Magnitude Collection No Data Type. True False Set … There is only Class. Char Number … Fraction Integer Float Lecture 14 – Smalltalk, Spring Lecture 14 – Smalltalk, Spring CSE3302 Programming Languages, UT-Arlington 3 CSE3302 Programming Languages, UT-Arlington 4 2008 ©Chengkai Li, 2008 2008 ©Chengkai Li, 2008 Syntax • Smalltalk is really “small” – Only 6 keywords (pseudo variables) – Class, object, variable, method names are self explanatory Sma llta lk Syn tax is Simp le. – Only syntax for calling method (messages) and defining method. • No syntax for control structure • No syntax for creating class Lecture 14 – Smalltalk, Spring Lecture 14 – Smalltalk, Spring CSE3302 Programming Languages, UT-Arlington 5 CSE3302 Programming Languages, UT-Arlington 6 2008 ©Chengkai Li, 2008 2008 ©Chengkai Li, 2008 1 3/8/2008 Expressions Literals • Literals • Number: 3 3.5 • Character: $a • Pseudo Variables • String: ‘ ’ (‘Hel’,’lo!’ and ‘Hello!’ are two objects) • Symbol: # (#foo and #foo are the same object) • Variables • Compile-time (literal) array: #(1 $a 1+2) • Assignments • Run-time (dynamic) array: {1. $a. 1+2} • Comment: “This is a comment.” • Blocks • Messages Lecture 14 – Smalltalk, Spring Lecture 14 – Smalltalk, Spring CSE3302 Programming Languages, UT-Arlington 7 CSE3302 Programming Languages, UT-Arlington 8 2008 ©Chengkai Li, 2008 2008 ©Chengkai Li, 2008 Pseudo Variables Variables • Instance variables.
    [Show full text]
  • Python Functions
    PPYYTTHHOONN FFUUNNCCTTIIOONNSS http://www.tutorialspoint.com/python/python_functions.htm Copyright © tutorialspoint.com A function is a block of organized, reusable code that is used to perform a single, related action. Functions provide better modularity for your application and a high degree of code reusing. As you already know, Python gives you many built-in functions like print, etc. but you can also create your own functions. These functions are called user-defined functions. Defining a Function You can define functions to provide the required functionality. Here are simple rules to define a function in Python. Function blocks begin with the keyword def followed by the function name and parentheses ( ). Any input parameters or arguments should be placed within these parentheses. You can also define parameters inside these parentheses. The first statement of a function can be an optional statement - the documentation string of the function or docstring. The code block within every function starts with a colon : and is indented. The statement return [expression] exits a function, optionally passing back an expression to the caller. A return statement with no arguments is the same as return None. Syntax def functionname( parameters ): "function_docstring" function_suite return [expression] By default, parameters have a positional behavior and you need to inform them in the same order that they were defined. Example The following function takes a string as input parameter and prints it on standard screen. def printme( str ): "This prints a passed string into this function" print str return Calling a Function Defining a function only gives it a name, specifies the parameters that are to be included in the function and structures the blocks of code.
    [Show full text]
  • Challenges in Debugging Dynamically Compiled Languages As Exemplified by C# Debugger for Tizen
    Samsung R&D Institute Russia Center of System Software Challenges in debugging dynamically compiled languages as exemplified by C# debugger for Tizen Dmitri Botcharnikov 1 Agenda Dynamically compiled languages Tizen .NET Debugging Challenges Tizen .NET Debugger internals Future plans 2 Dynamically compiled languages Dynamically (Just-In-Time) compiled languages VM manages low-level details: memory allocation, exception handling But for debuggers… 3 Tizen .NET Visual Studio Tools for Tizen preview were released C# was added to Tizen Over 1,400,000 C# developers worldwide Tizen running on 50 millions Samsung devices (TV, wearables, mobile, IoT) http://developer.tizen.org 4 Technologies Tizen OS (emulator, platform-specific APIs) Xamarin.Forms .NET Core (CoreCLR, CoreFX, Roslyn) Visual Studio 2015 (Windows) 5 C# Compilation & Execution C# source MSIL Output CLR Roslyn JIT Language-specific compiler: C# => MSIL CLR JIT compiler: MSIL => native code 6 Debugging Challenges Source code to native code mapping ◦ C# compiler generates debugging information for source code to MSIL mapping Stepping in and over ◦ Stepping into not yet compiled code ◦ Managed exception handlers ◦ Lambdas, closures & iterators Local variables & arguments inspection ◦ C# compiler generates debugging information for MSIL variables 7 LLDB Subproject of LLVM (http://lldb.llvm.org) Native debugger builds on LLVM and Clang libraries Supports X86 and ARM architectures 8 SOS debugger plug-in Plug-in for LLDB (libsosplugin.so, libsos.so) Port of SOS.dll
    [Show full text]
  • LLDB Tutorial: Adding Debugger Support for Your Target LLVM 2016 Tutorial
    LLDB Tutorial: Adding debugger support for your target LLVM 2016 tutorial Deepak Panickal Andrzej Warzyński Codeplay Soware @codeplayso March 18, 2016 Outline • LLDB architecture crash course I Overview of LLDB I User scenarios such as breakpoints, stack-walking etc. I Debugging ps • Both generic and specialized architectures are covered I MSP430 lldb debugging, which we have implemented for this tutorial I github.com/codeplaysoftware/lldb-msp430 I ARM architecture is also referred to for the generic cases • Focusing on debugging ELF executables on Linux EuroLLVM 2016 Outline 2 / 54 Overview Part 1: The Basics Part 2: ELF And Architecture Support Part 3: Registers Part 4: Memory and Breakpoints Part 5: Other Key Features Part 6: Debugging Tips Part 7: MSP430 Quick Recap EuroLLVM 2016 Outline 3 / 54 Part 1 The Basics EuroLLVM 2016 Part 1: The Basics 4 / 54 LLDB - Architecture lldb user driver TCP Socket GDB RSP . lldb-server debug API Architecture of LLDB LLDB offers mulple opons: I user drivers: command line, lldb-mi, Python I debug API: ptrace/simulator/runme/actual drivers EuroLLVM 2016 Part 1: The Basics 5 / 54 lldb/lldb-server lldb • Runs on host • Interacts with the user • Understands symbols, DWARF informaon, data formats, etc. • Plugin architecture I ProcessGDBRemote, DynamicLoaderPOSIXDYLD, ABISysV_msp430 are some... lldb-server • Runs on both remote and host, communicates to lldb via RSP over whichever medium is available • Interacts with the hardware/simulator • Deals with binary data and memory addresses • Plugin architecture I ObjectFileELF, ProcessLinux, are some... EuroLLVM 2016 Part 1: The Basics 6 / 54 GDB Remote Serial Protocol • Simple, ASCII message based protocol • Designed for debugging remote targets • Originally developed for gdb<->gdbserver communicaon • Extended for LLDB, see lldb-gdb-remote.txt Packet structure: checksum $.
    [Show full text]
  • Eff Directly in Ocaml
    Eff Directly in OCaml Oleg Kiselyov KC Sivaramakrishnan Tohoku University, Japan University of Cambridge, UK [email protected] [email protected] The language Eff is an OCaml-like language serving as a prototype implementation of the theory of algebraic effects, intended for experimentation with algebraic effects on a large scale. We present the embedding of Eff into OCaml, using the library of delimited continuations or the multicore OCaml branch. We demonstrate the correctness of the embedding denotationally, re- lying on the tagless-final–style interpreter-based denotational semantics, including the novel, direct denotational semantics of multi-prompt delimited control. The embedding is systematic, lightweight, performant and supports even higher-order, ‘dynamic’ effects with their polymorphism. OCaml thus may be regarded as another implementation of Eff, broadening the scope and appeal of that language. 1 Introduction Algebraic effects [33, 32] are becoming a more and more popular approach for expressing and com- posing computational effects. There are implementations of algebraic effects in Haskell [18, 22], Idris [4], OCaml [10, 18], Koka [27], Scala1, Javascript2, PureScript3, and other languages. The most direct embodiment of algebraic effect theory is the language Eff4 “built to test the mathematical ideas of alge- braic effects in practice”. It is an OCaml-like language with the native facilities (syntax, type system) to declare effects and their handlers [2]. It is currently implemented as an interpreter, with an optimizing compiler to OCaml in the works. Rather than compile Eff to OCaml, we embed it. After all, save for algebraic effects, Eff truly is a subset of OCaml and can be interpreted or compiled as a regular OCaml code.
    [Show full text]
  • An Overview of the Scala Programming Language
    An Overview of the Scala Programming Language Second Edition Martin Odersky, Philippe Altherr, Vincent Cremet, Iulian Dragos Gilles Dubochet, Burak Emir, Sean McDirmid, Stéphane Micheloud, Nikolay Mihaylov, Michel Schinz, Erik Stenman, Lex Spoon, Matthias Zenger École Polytechnique Fédérale de Lausanne (EPFL) 1015 Lausanne, Switzerland Technical Report LAMP-REPORT-2006-001 Abstract guage for component software needs to be scalable in the sense that the same concepts can describe small as well as Scala fuses object-oriented and functional programming in large parts. Therefore, we concentrate on mechanisms for a statically typed programming language. It is aimed at the abstraction, composition, and decomposition rather than construction of components and component systems. This adding a large set of primitives which might be useful for paper gives an overview of the Scala language for readers components at some level of scale, but not at other lev- who are familar with programming methods and program- els. Second, we postulate that scalable support for compo- ming language design. nents can be provided by a programming language which unies and generalizes object-oriented and functional pro- gramming. For statically typed languages, of which Scala 1 Introduction is an instance, these two paradigms were up to now largely separate. True component systems have been an elusive goal of the To validate our hypotheses, Scala needs to be applied software industry. Ideally, software should be assembled in the design of components and component systems. Only from libraries of pre-written components, just as hardware is serious application by a user community can tell whether the assembled from pre-fabricated chips.
    [Show full text]