Language Features “a la carte”

Dear teachers,

Language Features “a la carte” is an ongoing student project that allows you to check that a Scala program uses a specific subset of language features:

Scala is a general purpose programming language that supports multiple programming paradigms.

However, in some cases it is useful to restrict the language to a subset of its features. For example, a project may have policies about the code style that should be used (see for instance the WartRemover project that helps other projects to implement such policies). Also, tools performing verification on code may not support all the language features. Last, teachers may want to progressively introduce the language features.

All these use cases need a tool checking that a program does not use some specific language features.

Currently, scalafix and the aforementioned project WartRemover can check that some language features are not used.

However, the set of supported language features is incomplete. The goal of this project is to create a tool able to cover more features, such as contextual abstractions, abstract methods, method overrides, higher-kinded types, quotes and splices, etc.

This project could be applied in the context of teaching, for instance, to check that two solutions to a problem use different programming styles (OOP vs FP), or to make sure that a solution that is expected to be implemented in a pure FP style does not make use of mutability.

If you feel like such a project would be useful to you, we would be interested in knowing more about your use cases, and how you would like to use the tool in practice. Also, feel free to watch the project activity on GitHub and to contribute to it!


I’m a bit worried that this introduces unnecessary complications to students, as they then need to keep track of different Scala dialects - this might be daunting to a pure beginner. Also I’d like to keep Scala one language rather than a set of sub-languages (c.f. the rationale for principled meta programming instead of exposing the compiler to allow deep language modification creating dialects).

An alternative solution would be to offer warnings that can be turned on and off for some carefully selected things, such as mutable classes with exposed, non-local mutability.

See also Why scala is still keeping var in it? - #10 by Mahadi - Question - Scala Users

1 Like