Scala (programming language)

Scala
ParadigmMulti-paradigm: concurrent, functional, imperative, object-oriented
Designed byMartin Odersky
DeveloperProgramming Methods Laboratory of École Polytechnique Fédérale de Lausanne
First appeared20 January 2004; 20 years ago (2004-01-20)
Stable release
3.5.0[1] Edit this on Wikidata / 22 August 2024; 2 months ago (22 August 2024)
Typing disciplineInferred, static, strong, structural
Implementation languageScala
PlatformJava virtual machine (JVM)
JavaScript (Scala.js)
LLVM (Scala Native) (experimental)
LicenseApache 2.0[2]
Filename extensions.scala, .sc
Websitewww.scala-lang.org
Influenced by
Common Lisp,[3] Eiffel, Erlang, F#, Haskell,[4] Java,[5] OCaml,[5] Oz, Pizza,[6] Scheme,[5] Smalltalk, Standard ML[5]
Influenced
Ceylon, Chisel, Fantom, F#, C#, Kotlin, Lasso, Red, Flix

Scala (/ˈskɑːlɑː/ SKAH-lah)[7][8] is a strong statically typed high-level general-purpose programming language that supports both object-oriented programming and functional programming. Designed to be concise,[9] many of Scala's design decisions are intended to address criticisms of Java.[6]

Scala source code can be compiled to Java bytecode and run on a Java virtual machine (JVM). Scala can also be transpiled to JavaScript to run in a browser, or compiled directly to a native executable. When running on the JVM, Scala provides language interoperability with Java so that libraries written in either language may be referenced directly in Scala or Java code.[10] Like Java, Scala is object-oriented, and uses a syntax termed curly-brace which is similar to the language C. Since Scala 3, there is also an option to use the off-side rule (indenting) to structure blocks, and its use is advised. Martin Odersky has said that this turned out to be the most productive change introduced in Scala 3.[11]

Unlike Java, Scala has many features of functional programming languages (like Scheme, Standard ML, and Haskell), including currying, immutability, lazy evaluation, and pattern matching. It also has an advanced type system supporting algebraic data types, covariance and contravariance, higher-order types (but not higher-rank types), anonymous types, operator overloading, optional parameters, named parameters, raw strings, and an experimental exception-only version of algebraic effects that can be seen as a more powerful version of Java's checked exceptions.[12]

The name Scala is a portmanteau of scalable and language, signifying that it is designed to grow with the demands of its users.[13]

  1. ^ https://www.scala-lang.org/download/3.5.0.html. {{cite web}}: Missing or empty |title= (help)
  2. ^ "Notice file". GitHub. 2019-01-24. Retrieved 2019-12-04.
  3. ^ "Scala Macros".
  4. ^ Fogus, Michael (6 August 2010). "MartinOdersky take(5) toList". Send More Paramedics. Retrieved 2012-02-09.
  5. ^ a b c d Odersky, Martin (11 January 2006). "The Scala Experiment - Can We Provide Better Language Support for Component Systems?" (PDF). Retrieved 2016-06-22.
  6. ^ a b Odersky, Martin; et al. (2006). "An Overview of the Scala Programming Language" (PDF) (2nd ed.). École Polytechnique Fédérale de Lausanne (EPFL). Archived (PDF) from the original on 2020-07-09.
  7. ^ Odersky, Martin (2008). Programming in Scala. Mountain View, California: Artima. p. 3. ISBN 9780981531601. Retrieved 12 June 2014.
  8. ^ Wampler, Dean; Payne, Alex (15 September 2009). Programming Scala: Scalability = Functional Programming + Objects. O'Reilly Media, Inc. p. 7. ISBN 978-1-4493-7926-1. Retrieved 13 May 2024. The creators of Scala actually pronounce it scah-lah, like the Italian word for "stairs." The two "a"s are pronounced the same.
  9. ^ Potvin, Pascal; Bonja, Mario (24 September 2015). SDL 2013: Model-Driven Dependability Engineering. Lecture Notes in Computer Science. Vol. 7916. arXiv:1509.07326. doi:10.1007/978-3-642-38911-5. ISBN 978-3-642-38910-8. S2CID 1214469.
  10. ^ "Frequently Asked Questions: Java Interoperability". Scala-lang.org. Retrieved 2015-02-06.
  11. ^ Martin Odersky (17 June 2020). Martin Odersky: A Scala 3 Update (video). YouTube. Event occurs at 36:35–45:08. Archived from the original on 2021-12-21. Retrieved 2021-04-24.
  12. ^ "Effect expt". scala. Retrieved 2022-07-31.
  13. ^ Loverdo, Christos (2010). Steps in Scala: An Introduction to Object-Functional Programming. Cambridge University Press. p. xiii. ISBN 9781139490948. Retrieved 31 July 2014.