Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

In the paper “An Extended Comparative Study of Language Support for Generic Programming” by Garcia et al. an interesting comparison of programming languages features for generic programming is given:

enter image description here

with the brief explanation of terminology:

enter image description here

Can anyone test Scala support for generic programming inside this framework? I.e. add a column in the first table with explanations if possible.

share|improve this question
3  
Reposted on Computer Science. Please don't do that. If you want to move your question to another site which you feel is more suitable, flag for moderator attention and request a migration. –  Gilles Nov 25 '12 at 19:26
2  
Exact answer is given on p. 17 of “Type classes as Objects and Implicits” by Oliveira et al. –  Artem Pelenitsyn Nov 26 '12 at 6:27
    
The reference comes from Twitter after the link to CS.SE beta question trickled there. Thanks to Miles Sabin (@milessabin on Twitter) and Alexey Romanov. –  Artem Pelenitsyn Nov 26 '12 at 6:31
    
Have a look at miles Sabins shapeless library and his motivation behind te lib. I think references some papers –  AndreasScheinert Nov 26 '12 at 11:27

1 Answer 1

up vote 6 down vote accepted

As mentioned in one of the comments from the OP, this is the table that explains how Scala compares for generic programming support. Link to source pdf

table with Scala listed

Later on, the following summary is provided:

Scala
Using the CONCEPT pattern we can model multi-type concepts, multiple constraints and support retroactive modeling. Furthermore, Scala’s support for implicits means that the drawbacks of the Java and C# solutions in terms of the additional overhead, do not apply to Scala. Thus, Scala scores well in both the implicit argument deduction and the retroactive modeling criteria. Section 6 shows that associated types are supported in Scala through type members and dependent method types, and type members can also be used as type aliases.
As shown in Section 3, Scala supports lexically scoped models. Furthermore type-checking is fully modular. Prioritized overlapping implicits provide some support for concept-based overloading as illustrated by the zipWithN example in Section 6.5. However, overlapping models have to be structured using a subtyping hierarchy, which may not always be desirable. Thus, the score for this feature is only sufficient. Finally, Scala has full support for first-class functions and it also supports equality constraints.
In summary Scala turns out to be a language with excellent support for generic programming features, managing to fare at the same level, or even slightly better, than G (which was specially designed as a language for generic programming in the large) or Haskell (which has been recognized has having very good support for generic programming).

And then in the summary:

Type members and dependent method types add extra power to the language and a combination of the two mechanisms allows associated types to be expressed. In combination with implicits, type members and dependent method types make Scala an language ready for generic programming in the large

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.