Cross-Platform Language Design - Sébastien Doeraene - Ph.D. thesis

栏目: IT技术 · 发布时间: 3年前

内容简介:Sébastien Doeraene, Ph.D. thesisThis is the thesis behind

Cross-Platform Language Design

Sébastien Doeraene, Ph.D. thesis

Full text

This is the thesis behind Scala.js , the dialect of Scala that compiles to JavaScript.

Abstract

Programming languages are increasingly compiled to multiple runtimes, each featuring their own rich structures such as their object model. Furthermore, they need to interact with other languages targeting said runtimes. A language targeting only one runtime can be designed to tailor its semantics to those of that runtime, for easy interoperability with other languages. However, in a language targeting multiple runtimes with differing semantics, it is difficult to cater to each of them while retaining a common behavior across runtimes. We call cross-platform language a language that aims at being both portable across platforms and interoperable with each target platform. Portability is the ability for a program or a library to cross-compile for multiple platforms, and behave the same way on all of them. Interoperability is the ability to communicate with other languages on the same platform. While many cross-compiling languages focus on one of these two properties—only adding support for the other one as an afterthought—, languages that are designed from the ground up to support both are rare.

In this thesis, we present the design of Scala.js, the dialect of Scala targeting the JavaScript platform, which turned Scala into a cross-platform language. On the one hand, Scala programs can be cross-compiled for the JVM and JavaScript with portable semantics. On the other hand, whereas Scala/JVM interoperates with Java, Scala.js interoperates with JavaScript, allowing to use any JavaScript library. Along the dissertation, we give insights that can be transferred to the design of other cross-platform languages, although with a bias towards those targeting the JVM and JavaScript.

The first and most obvious challenge is to reconcile the static nature of Scala's object model with JavaScript's dynamic one. Besides the ability to mutate a class hierarchy at run-time in JavaScript, there are fundamental differences between the two models, in particular the difference between compile-time overloading and run-time overloading. We discuss how such semantic mismatches can live in harmony within the language.

The second challenge is to obtain good performance from a language where interoperability with a dynamic and unknown part of the program is pervasive. To that end, we design and specify an intermediate representation (IR) with first-class support for dynamically typed interoperability features in addition to statically typed JVM-style operations. Despite its tight integration with the open world of JavaScript, most of the IR can be considered as a closed world where advanced whole-program optimizations can be performed. The performance of the overall system is evaluated and shown to be competitive with hand-written JavaScript, and even with Scala/JVM in some cases.

Keywords: interoperability, portability, language design, cross-platform, performance, Scala, JavaScript.


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

企业应用架构模式

企业应用架构模式

Martin Fowler、王怀民、周斌 / 王怀民、周斌 / 机械工业出版社 / 2004-7 / 49.00元

本书作者是当今面向对象软件开发的权威,他在一组专家级合作者的帮助下,将40多种经常出现的解决方案转化成模式,最终写成这本能够应用于任何一种企业应用平台的、关于解决方案的、不可或缺的手册。本书获得了2003年度美国软件开发杂志图书类的生产效率奖和读者选择奖。本书分为两大部分。第一部分是关于如何开发企业应用的简单介绍。第二部分是本书的主体,是关于模式的详细参考手册,每个模式都给出使用方法和实现信息,并一起来看看 《企业应用架构模式》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

html转js在线工具
html转js在线工具

html转js在线工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具