Nice TWiki > Doc > LanguageComparisons > NiceVersusScala (r1.6) TWiki webs:
Dev | Doc | Main | TWiki | Sandbox
Doc . { Changes | Index | Search | Go }

Scala

Scala has many things in common with Nice: "Scala is a modern multi-paradigm programming language designed to express common programming patterns in a consise, elegant, and type-safe way. It smoothly integrates features of object-oriented and functional languages".

There are also fundamental differences: Scala has far less in common with Java (Scala targets CLR as-well-as JVM), single dispatch, F Bounded Polymorphism.

Classes

  Unified Types Traits Mixins External Methods Inner classes Abstract Interfaces
Nice Yes Yes(1) No Yes No Yes
Scala Yes Yes Yes No Yes No

Nice and Scala move forward OO programming in different ways. Nice addresses the problems of adding functionality to existing classes and binary methods with Multi Methods; Scala addresses the problem of implementation reuse with Traits and Mixins.

(1)I don't see any difference between traits in Scala and interfaces with default implementation in Nice

I'd like that! Traits can include method implementations not just declarations

Methods

  Anonymous Functions Higher-Order Functions Currying Dynamic Dispatch Nested Functions
Nice Yes Yes Not yet(at call site) Multiple Dispatch Yes
Scala Yes Yes Yes(at definition) Single Dispatch Yes

Type Parameters

  Generic Classes Generic Methods Variant Class Type Parameters Upper Type Bounds Lower Type Bounds Multiple Bounds
Nice Yes Yes Yes(2) Yes Yes Yes
Scala Yes Yes Yes Yes Yes ?

(2) Although the typechecking isn't completely implemented yet

So wouldn't that be Not yet, or Not complete?

Java Commonality

  Use Java classes Parameterize Java classes Subclass Java classes Use in Java Java Statements/Operators
Nice Yes Yes Yes Yes Yes
Scala Yes ? Yes Maybe No

Although Scala can use Java classes (and in the future .Net classes) there's no intent to make the language familiar to Java programmers; Nice looks more like a Java 3.0 than an entirely new language.

Other

Methods Pattern Matching Local Type Inference Comprehensions Option Types User Defined Coercions Tuples
Nice Multi Methods Some: Monomorphic Vars No String & ?String No Yes
Scala Case classes Yes(3) Yes Some(String) & None Yes Library

(3) Has Scala no restrictions on local type inference?

Seems to work for monomorphic and polymorphic local variables, and non-recursive functions

Made a few additions -- ArjanB - 24 Jan 2004

Grateful for the help, I'll continue to add stuff too - then we can reconcile the differences and clean up. (I started off including the list of features from the Scala overview and then removed some.)

Topic NiceVersusScala . { Edit | Attach | Ref-By | Printable | Diffs | r1.22 | > | r1.21 | > | r1.20 | More }
Revision r1.6 - 24 Jan 2004 - 18:08 GMT - IsaacGouy
Parents: WebHome > LanguageComparisons
Copyright © 1999-2003 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback.