Exploring the flexibility of Scala Implicits towards an Extensible Live Environment
Vasco André da Costa Grilo · 2013
This thesis presents the research and implementation details of an extensible live development environment for the Scala programming language called Visual Scala. It also describes the exploration of the flexibility of Scala’s implicits towards such an environment. Scala is an ObjectFunctional programming language created by Martin Odersky which has been growing in popularity over the past few years. When talking about development environments which support dynamic execution of code during runtime probably the most famous example are Read-Eval-Print Loops. REPLs are interactive top-level environments usually associated with dynamic or functional languages. Although they provide quick ways of inspecting and exploring a certain programming language, they stick to verbose textual representations of the intermediate values that are being generated by the programmer. We feel such an approach is rather limiting to our understanding of data structures and the effects of computation and so we propose to develop a development environment for Scala built on top of the Scala’s standard REPLs with an associated library for converting type values to graphical representations. Using the power of Scala’s Implicits conversions we want to explore how flexible they can be when implementing an innovative mechanism of converting data structures to rich, interactive visualizations. As a web application, benefiting from HTML, CSS and JavaScript, along with the power of D3, a library for easily create graphical representations of data, Visual Scala offers an easily extensible and innovative conversions library for Scala’s native type values. In this way, end users can interact with Visual Scala in a command-line fashion, with expressions resulting in rich graphical “widgets” instead of verbose text. From reviewing the state of the art we find that there are similar tools which provide graphical representations of data structures, however they are usually intended for more technical and mathematical computing. The Julia Language is a very interesting example of such tools, although it provides graphical conversions in an explicit way and does not allow for new conversions to be created by the end-user. We feel that such a component, implicitly generating these graphics, for a more general purpose programming language, like Scala, is an interesting subject to explore and can have a significant impact on the community. From implementing and exploring Visual Scala we conclude that Scala’s Implicits provide high flexibility for developing a mechanism of invoking the right conversion for the right type value at hand. The resulting Conversions Library apart from being extremely flexible, is also easily extensible as it is not part of the running backend system and instead an external resource component. By evaluating user code by using the standard Scala’s interpreter, Visual Scala also provides a “live” environment which maximizes graphical conversion of intermediate data throughout development.