Scala (programming language): Difference between revisions

Content deleted Content added
top: changing IPA transcription, adding second source for pronunciation
m top: italics
Line 20:
| influenced = [[Ceylon (programming language)|Ceylon]], [[Chisel (programming language)|Chisel]], [[Fantom (programming language)|Fantom]], [[F Sharp (programming language)|F#]], [[C Sharp (programming language)|C#]], [[Kotlin (programming language)|Kotlin]], [[Lasso (programming language)|Lasso]], [[Red (programming language)|Red]], [[Flix (programming language)|Flix]]
}}
'''Scala''' ({{IPAc-en|ˈ|s|k|ɑː|l|ɑː}} {{respell|SKAH|lah}})<ref>{{cite book |last=Odersky |first=Martin |date=2008 |title=Programming in Scala |url=https://books.google.com/books?id=MFjNhTjeQKkC&q=scala%20is%20pronounced%20skah-lah&pg=PA3 |___location=Mountain View, California |publisher=Artima |page=3 |isbn=9780981531601 |access-date=12 June 2014}}</ref><ref>{{cite book |last1=Wampler |first1=Dean |last2=Payne |first2=Alex |title=Programming Scala: Scalability = Functional Programming + Objects |date=15 September 2009 |publisher=O'Reilly Media, Inc. |isbn=978-1-4493-7926-1 |page=7 |url=https://books.google.com/books?id=mincYfsQleMC&lpg=PA7&ots=r62-JQSJd5&dq=scala%20pronunciation&pg=PA7#v=onepage&q=scala%20pronunciation&f=false |access-date=13 May 2024 |language=en |quote=The creators of Scala actually pronounce it ''scah-lah'', like the Italian word for "stairs." The two "a"s are pronounced the same.}}</ref> is a [[Strong and weak typing|strong]] [[Static typing|statically typed]] [[High-level programming language|high-level]] [[general-purpose programming language]] that supports both [[object-oriented programming]] and [[functional programming]]. Designed to be concise,<ref>{{Cite book |arxiv=1509.07326|volume=7916 |last1=Potvin |first1=Pascal |last2=Bonja |first2=Mario |title=SDL 2013: Model-Driven Dependability Engineering |date=24 September 2015 |doi= 10.1007/978-3-642-38911-5|series=Lecture Notes in Computer Science |isbn=978-3-642-38910-8 |s2cid=1214469}}</ref> many of Scala's design decisions are intended to address [[criticism of Java|criticisms of Java]].<ref name="overview"/>
 
Scala source code can be compiled to [[Java bytecode]] and run on a [[Java virtual machine]] (JVM). Scala can also be compiled to [[JavaScript]] to run in a browser, or directly to a native executable. On the Italic text JVM Scala provides [[language interoperability]] with [[Java (programming language)|Java]] so that libraries written in either language may be referenced directly in Scala or Java code.<ref>{{cite web |url=https://www.scala-lang.org/old/faq/4 |title=Frequently Asked Questions: Java Interoperability |author=<!--Staff writer(s); no by-line.--> |website=Scala-lang.org |access-date=2015-02-06}}</ref> Like Java, Scala is [[Object-oriented programming|object-oriented]], and uses a [[Syntax (programming languages)|syntax]] termed ''[[List of programming languages by type#Curly-bracket languages|curly-brace]]'' which is similar to the language [[C (programming language)|C]]. Since Scala 3, there is also an option to use the [[off-side rule]] (indenting) to structure [[Block (programming)|blocks]], and its use is advised. [[Martin Odersky]] has said that this turned out to be the most productive change introduced in Scala 3.<ref>{{Cite AV media |people=Martin Odersky |date=17 June 2020 |title=Martin Odersky: A Scala 3 Update |medium=video |language=en |url=https://www.youtube.com/watch?v=Z0w_pITUTyU |archive-url=https://ghostarchive.org/varchive/youtube/20211221/Z0w_pITUTyU |archive-date=2021-12-21 |url-status=live|time=36:35–45:08 |publisher=YouTube |access-date=2021-04-24}}{{cbignore}}</ref>
 
Unlike Java, Scala has many features of [[functional programming]] languages (like [[Scheme (programming language)|Scheme]], [[Standard ML]], and [[Haskell (programming language)|Haskell]]), including [[currying]], [[immutability]], [[lazy evaluation]], and [[pattern matching]]. It also has an advanced type system supporting [[algebraic data type]]s, [[covariance and contravariance (computer science)|covariance and contravariance]], [[higher-order type operator|higher-order types]] (but not [[Parametric polymorphism|higher-rank types]]), [[anonymous type]]s, [[operator overloading]], [[Option type|optional parameters]], [[named parameter]]s, [[raw string]]s, and an experimental exception-only version of algebraic effects that can be seen as a more powerful version of Java's [[checked exception]]s.<ref>{{Cite web|title=Effect expt|url=https://docs.scala-lang.org/scala3/reference/experimental/canthrow.html|access-date=2022-07-31|website=scala}}</ref>