Talk:Scala (programming language)

This is an old revision of this page, as edited by Graham87 (talk | contribs) at 02:54, 24 March 2012 (move from Talk:Scala). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

WikiProject iconJava Start‑class Low‑importance
WikiProject iconThis article is within the scope of WikiProject Java, a collaborative effort to improve the coverage of Java on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
StartThis article has been rated as Start-class on Wikipedia's content assessment scale.
LowThis article has been rated as Low-importance on the project's importance scale.
WikiProject iconComputing Unassessed
WikiProject iconThis article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
???This article has not yet received a rating on Wikipedia's content assessment scale.
???This article has not yet received a rating on the project's importance scale.

Belgian Band

What about the band from Belgium? — Preceding unsigned comment added by 217.82.196.35 (talk) 17:52, 3 December 2004 (UTC)Reply

Make this a disambiguation page?

The programming language and the music stuff should not be in one article... — Preceding unsigned comment added by 24.217.227.208 (talk) 03:46, 23 April 2005 (UTC)Reply

You should also consider the scala that makes digital signage software. — Preceding unsigned comment added by 63.145.211.105 (talk) 21:29, 1 August 2005

To get an idea how many different Scala's there are, look at this page... http://www.scala.org.au/linscala.htm — Preceding unsigned comment added by 63.145.211.105 (talk) 20:49, 2 November 2005

Promotion.

Seems to me that this article is a bit too promoting of the Scala language. A more neutral p-o-w would be in place.

Which parts specifically do you think should be changed? -- Phouk

I didn't write the first comment about it being too self-promoting, but it certainly has that feel. Here's an example sentence: "Scala provides a unique combination of language mechanisms that make it easy to smoothly add new language constructs in the form of libraries". The word "unique" is particularly objectionable. There are (at least) thousands of interpreted languages out there. Is scala truly the only one for which it is "easy to smoothly add new language constructs in the form of libraries" to?

IMHO, if 'unique' is kept, it should be supported by an external quote / citation. Alternatively, what about calling it a 'novel' approach. The way Scala can be extended is indeed strikingly different from what we know of other mainstream languages (It's not dynamically rebinding a prototype and it's not some kind of macro feature) 93.104.71.211 (talk) 23:08, 25 February 2011 (UTC)Reply

Scala might be very good, of course. But the words "performance", "speed", "scope", and "memory" do not appear in the current form of the article, so it doesn't have the feel of a dispassionate examination of the language. Son of eugene (talk) 19:09, 30 October 2010 (UTC)Reply


12.27.255.133 21:51, 27 September 2007 (UTC) The Scala homepage doesn't say anything about .Net, just the JVM...Reply

See point 5.2 in the faq (http://www.scala-lang.org/docu/faq.html#id2244551): Q: Does Scala work on .NET? A: There are plans for Scala to run on .NET, and the previous version of Scala ran on .NET, but the current version does not. While .NET has many similarities to Java, it has enough idiosyncrasies that the port is non-trivial. -- Phouk

As of May 6, 2008, supporting the .NET backend is a current focus of the Scala team. This feature did languish for a while. —Preceding unsigned comment added by 128.197.41.105 (talk) 16:29, 7 May 2008 (UTC)Reply

Quick sort example

I propose the following variant of quick sort, which uses List.partition and does a slightly simpler concatenation. I think it is easier to understand.

 def qsort(l: List[Int]): List[Int] = {
   l match {
       case Nil => l
       case pivot :: tail =>
       {
         val (lt, gte) = tail.partition(_ < pivot)
         qsort(lt) ::: pivot :: qsort(gte)
       }
   }
 }

Opinions?

--DavidBiesack (talk) 22:17, 7 February 2008 (UTC)Reply

Just my opinion: the existing example is meant to be a direct translation of the Erlang example, and allowing the reader to compare the syntax on the same code is important. For me the current example is quite easy to understand and has a more "functional" style. And yep, the point is that in functional programs one line of code can express much more than in imperative ones, so they're too short for the imperative programmer to understand, but that's the coding style I've seen used by experienced programmers most of the time, so IMHO one just has to get used, and I'd keep this.
I have studied Scheme and Haskell at a university course (and a bit more of Haskell), and I still remember that feeling (I mean, I never got really used to functional programming, unfortunately), so I'm arguing this even if I'm no expert. And all my previous contact with Scala was a paper with examples in Scala, explained to our class in less than one hour.

So, the only good point of your version is that it should be slightly faster since it uses List.partition and does just one pass on the list, but that's not relevant for an introductory article, IMHO. --Blaisorblade (talk) 03:17, 7 January 2009 (UTC)Reply

Maybe I'm wrong, but I think the example has a bug: What happens if the pivot element is in the list more than once? For example: "2, 2, 3" In this case, the result of sorting would be "2, 3", because every element with the same value as the pivot element is filtered out, but only one element with the value of the pivot element is reinserted. To correct it, I would replace "tail.filter(_ >= pivot)" with "tail.filter(_ > pivot)" and not insert the pivot element manually. --84.177.151.15 (talk) 21:39, 22 September 2009 (UTC)Reply

polymorphic methods.

The article currently contains a reference to 'Polymorphic methods' which cross links to Polymorphism (computer science) which is a redirect to Type polymorphism. Is there a better page to link to? Regards, Ben Aveling 09:11, 7 September 2008 (UTC)Reply

Add performance discussion?

No discussion about the performance cost of advanced Scala features is present. I have reasons to believe their support for advanced features has some cost, some discussion about that is present here: http://wiki.jvmlangsummit.com/ScalaOptimization, since a "future works" section is present. Could someone add a mention of that? --Blaisorblade (talk) 03:30, 7 January 2009 (UTC)Reply

Further, there is an associated published workshop paper which we can cite:
— Matt Crypto 10:18, 7 January 2009 (UTC)Reply

Pronunciation of Scala

The given pronunciation doesn't seem right. The main author of Scala (Odersky) pronounces it (in the podcast referenced by the article, for example) as the Italian word (meaning stairs, stairway, ladder etc.). Something like /'ska:la/ in fake IPA. I'm not sure how to show both pronunciations in Wiki but I'd be even happier with just the one correct pronunciation. —Preceding unsigned comment added by 92.234.33.124 (talk) 20:09, 11 February 2009 (UTC)Reply

See also: http://scala.sygneca.com/faqs/general#how-is-scala-pronounced 92.234.33.124 (talk) 20:21, 11 February 2009 (UTC)Reply

It should also be noted that the proper pronunciation (which is skah-lah) can be found in a footnote on page 3 of "Programming in Scala" by Martin Odersky, Lex Spoon, and Bill Venners (http://www.artima.com/shop/programming_in_scala). Enum (talk) 05:55, 23 January 2010 (UTC)Reply

Imperative programming in Scala?

This article does not say whether Scala allows imperative (non-functional) programming style. Please ammend the article with an answer on the question whether Scala is a purely functional, mostly functional, or both functional and imperative language. 77.127.45.42 (talk) 00:29, 14 November 2009 (UTC)Reply

From what I understand, it supports scripting / imperative style, object oriented style, and functional style. It also implements the actor model for concurrency. I think all of these things should be added to the article. Enum (talk) 05:48, 23 January 2010 (UTC)Reply

A Scala program can be purely imperative, purely functional or a mix of both styles. It is advisable to minimize or eliminate imperative coding involving concurrency. —Preceding unsigned comment added by 24.29.41.118 (talk) 06:52, 19 May 2010 (UTC)Reply

Correctness of given functional quicksort?

In...

  def qsort(list: List[Int]): List[Int] = 
  list match {
    case Nil => Nil
    case pivot::tail => qsort(tail.filter(_ < pivot)) ::: pivot :: qsort(tail.filter(_ >= pivot))
  }

... it seems to me that the code may [always does?] yield an incorrect duplication of the pivot value [1 more copy than in the input], and yet changing "qsort(tail.filter(_ >= pivot))" to "qsort(tail.filter(_ > pivot))" will only replace one problem with another: now, the pivot value will be represented only once in the sorted output even if it was present multiple times in the input. I think the "solution" is to replace the existing example with the one above [i.e. on this talk page]. Maybe I am misunderstanding something here. Comments and/or suggestions? —Preceding unsigned comment added by 66.114.69.71 (talk) 07:41, 26 November 2009 (UTC)Reply

The code in the article at the time of this comment works (though it could be optimized with a tail call). Enum (talk) 05:50, 23 January 2010 (UTC)Reply

Correct Scala code for qsort

I think the partitioning of the collection was not done correctly, pivot is the element in the middle of the sequence, in the traditional quick-sort algorithm. Moreover a good typing would use Seq instead of List or Array.

	def qsort(seq: Seq[Int]): Seq[Int] = {
		if (seq.length < 2)
			seq
		else {
			val pivot = seq(seq.length / 2)
			qsort(seq.filter(pivot > _)) ++
				seq.filter(pivot == _) ++
				qsort(seq.filter(pivot < _))
		}
	}

(not signed)

In an ideal case, the pivot would be set to the median of the values contained in the list. Choosing a number in the middle of a list of randomly distributed numbers would not improve speed at all, only harm it by adding a division to every recursive call (Though division is also considered a constant-time operation). In any case, I think the argument against the current version is moot and would not improve the article. Enum (talk) 06:05, 23 January 2010 (UTC)Reply

Sources

Some source links seem to point to wrong or dead resources (e.g. [2] would point to .NET if the link were not dead, although the text talks about Java Micro Edition).


--Segfaulthunter (talk) 01:11, 26 June 2010 (UTC)Reply

Too close for comfort / barely-disguised plagiarism?

Article: Scala is a pure object-oriented language in the sense that every value is an object. Data types and behaviors of objects are described by classes and traits. Class abstractions are extended by subclassing and by a flexible mixin-based composition mechanism to avoid the problems of multiple inheritance.

scala-lang.org: Scala is a pure object-oriented language in the sense that every value is an object. Types and behavior of objects are described by classes and traits. Classes are extended by subclassing and a flexible mixin-based composition mechanism as a clean replacement for multiple inheritance.

Article: The design of Scala acknowledges the fact that, in practice, the development of ___domain-specific applications often requires ___domain-specific language extensions. Scala provides a novel combination of language mechanisms that make it easy to smoothly add new language constructs in the form of libraries:

  • any method may be used as an infix or postfix operator, and
  • closures are constructed automatically depending on the expected type (target typing).

A joint use of both features facilitates the definition of new statements without extending the syntax and without using macro-like meta-programming facilities.

scala-lang.org: The design of Scala acknowledges the fact that in practice, the development of ___domain-specific applications often requires ___domain-specific language extensions. Scala provides a unique combination of language mechanisms that make it easy to smoothly add new language constructs in form of libraries:

- any method may be used as an infix or postfix operator, and

- closures are constructed automatically depending on the expected type (target typing).

A joint use of both features facilitates the definition of new statements without extending the syntax and without using macro-like meta-programming facilities.


There may be more; I see nothing on Scala's site indicating that the text was released under Creative Commons. I'm hoping someone will verify that I'm not overlooking something obvious :) — anndelion  22:24, 12 April 2011 (UTC)Reply