Nice TWiki > Doc > NiceVersusScala (r1.1 vs. r1.22) TWiki webs:
Dev | Doc | Main | TWiki | Sandbox
Doc . { Changes | Index | Search | Go }
 <<O>>  Difference Topic NiceVersusScala (r1.22 - 26 Jul 2005 - TWikiGuest)
Changed:
<
<

Every Scala expression has a value, so there are fewer explicit return statements - I'm familiar with that from Smalltalk, so it's difficult to judge if I just like it because it's familiar. In some cases Scala syntax seems more consistent; Nice seems to extend Java and so add syntax. For example, def square(x: Int) = { var y=x; y*y } and def square(x: Int) = x*x; whereas Nice has int square(int x){ var y=x; return y*y; } and a shorthand form int square(int x) = x*x;

>
>

Every Scala expression has a value, so there are fewer explicit return statements - I'm familiar with that from Smalltalk, so it's difficult to judge if I just like it because it's familiar. In some cases Scala syntax seems more consistent; Nice seems to extend Java and so add syntax. For example, in Scala there is def square(x: Int) = { var y=x; y*y } which can be shortened to def square(x: Int) = x*x; whereas in Nice it is int square(int x){ var y=x; return y*y; } and the shorthand form is int square(int x) = x*x;


 <<O>>  Difference Topic NiceVersusScala (r1.21 - 03 Apr 2005 - TWikiGuest)
Deleted:
<
<

化工泵 净化设备 稳压电源 初级会计师 留学签证 珠海生活 波峰焊 晶振 移动PC 视频点播 聊天室 消毒 越野车 电容器 电磁阀 类风湿 留学专家 首饰 晶体 内存 东莞生活 拓展训练 股票证券 留学中介 广告 电教 液晶屏 超声波 桌面 黑客帝国 挤出机 汽车租赁 消毒液 博天堂 投影仪 黄历 液晶显示器 温控器 动画 屏幕保护 白癜风 垫片 证券 电热膜 主机 户外 扑克 防火墙 肝硬化 注册税务师 广东生活 逆变电源 北京现代汽车 枫叶卡 资源库 风湿 脉管炎 汇款 电脑报价 西联 工作站 监控 广州生活 空间租用 信息化 螺丝 套管 外语 强直性脊柱炎 邮件系统 办公楼 胶粘剂 压力变送器 电线 铃声 皮具 星座 扣件 印花 工商注册 温度计 实验台 歌曲下载 文化 工业控制 雨伞 管理咨询公司 证卡打印机 液压件 注册 助剂 豆粕 胰岛素泵 电子元件 链条 流水线 防爆电机 水处理公司 水产品 紧固件 铸件 保健品 粉末涂料 文件柜 工装 隔离器 中药 手推车 光通信 喷涂设备 铸造 绿茶 宽带接入 计算机学校 工控 激光测距仪 清洗机 尖锐湿疣 网络布线 手电筒 读卡器 网络维护 数码管 栈板 蜂胶 打码机 思科 托盘 免费下载 野营用品 护肤 絮凝剂 色织布 护肤品 儿童玩具 人才招聘 旅游用品 减速电机 金属材料 不锈钢制品 癫痫 电视 电视剧 电工工具 电动摩托车 客车 抛光 黄页 磨床 洗地机 木门 圆珠笔 铜门 调节阀 搜索引擎 环境实验设备 塑料管材 呼吸机 节能 电解电容 网页 医疗 司法考试 结婚 防腐涂料 玻璃仪器 书店 光盘制作 医药 音乐网站 臭氧 网球 铁柜 医院管理 洗衣 致富信息 冠心病 保姆 报关 法语 散热片 毛巾 形象设计


 <<O>>  Difference Topic NiceVersusScala (r1.20 - 27 Jan 2005 - LiYan)
Added:
>
>

化工泵 净化设备 稳压电源 初级会计师 留学签证 珠海生活 波峰焊 晶振 移动PC 视频点播 聊天室 消毒 越野车 电容器 电磁阀 类风湿 留学专家 首饰 晶体 内存 东莞生活 拓展训练 股票证券 留学中介 广告 电教 液晶屏 超声波 桌面 黑客帝国 挤出机 汽车租赁 消毒液 博天堂 投影仪 黄历 液晶显示器 温控器 动画 屏幕保护 白癜风 垫片 证券 电热膜 主机 户外 扑克 防火墙 肝硬化 注册税务师 广东生活 逆变电源 北京现代汽车 枫叶卡 资源库 风湿 脉管炎 汇款 电脑报价 西联 工作站 监控 广州生活 空间租用 信息化 螺丝 套管 外语 强直性脊柱炎 邮件系统 办公楼 胶粘剂 压力变送器 电线 铃声 皮具 星座 扣件 印花 工商注册 温度计 实验台 歌曲下载 文化 工业控制 雨伞 管理咨询公司 证卡打印机 液压件 注册 助剂 豆粕 胰岛素泵 电子元件 链条 流水线 防爆电机 水处理公司 水产品 紧固件 铸件 保健品 粉末涂料 文件柜 工装 隔离器 中药 手推车 光通信 喷涂设备 铸造 绿茶 宽带接入 计算机学校 工控 激光测距仪 清洗机 尖锐湿疣 网络布线 手电筒 读卡器 网络维护 数码管 栈板 蜂胶 打码机 思科 托盘 免费下载 野营用品 护肤 絮凝剂 色织布 护肤品 儿童玩具 人才招聘 旅游用品 减速电机 金属材料 不锈钢制品 癫痫 电视 电视剧 电工工具 电动摩托车 客车 抛光 黄页 磨床 洗地机 木门 圆珠笔 铜门 调节阀 搜索引擎 环境实验设备 塑料管材 呼吸机 节能 电解电容 网页 医疗 司法考试 结婚 防腐涂料 玻璃仪器 书店 光盘制作 医药 音乐网站 臭氧 网球 铁柜 医院管理 洗衣 致富信息 冠心病 保姆 报关 法语 散热片 毛巾 形象设计


 <<O>>  Difference Topic NiceVersusScala (r1.19 - 23 Jan 2005 - TWikiGuest)

 <<O>>  Difference Topic NiceVersusScala (r1.18 - 30 May 2004 - IsaacGouy)
Changed:
<
<

This at a glance comparison is based on Scala version 1.0.0-b6 and Nice version 0.9.6

>
>

This at a glance comparison is based on Scala version 1.0.0-b6 and Nice version 0.9.8

Changed:
<
<

Some of these differences can be seen in the following example. In Scala we use a HashMap defined in a Scala library; in Nice we parameterize the Java HashMap. In Scala we use a sequence comprehension; in Nice an extended for statement, or a Java for statement.

>
>

Some of these differences can be seen in the following example. In Scala we use a HashMap defined in a Scala library; in Nice we use local type inference with the Java HashMap. In Scala we use a sequence comprehension; in Nice an extended for statement, or a Java for statement.

Changed:
<
<

HashMap? table = new HashMap?();

>
>

let table = new HashMap?();


 <<O>>  Difference Topic NiceVersusScala (r1.17 - 26 Feb 2004 - IsaacGouy)
Changed:
<
<

Scala Yes Yes Yes Yes Yes ?
>
>

Scala Yes Yes Yes Yes Yes Yes
Changed:
<
<

Scala Yes No Yes ? No
>
>

Scala Yes No Yes Yes No
Changed:
<
<

table += Integer.toString(i, 16) -> i;

>
>

table(Integer.toString(i, 16)) = i;

Changed:
<
<

Console println(count);

>
>

Console.println(count);

Changed:
<
<

if (i>0) i; else 1;

>
>

if (i>0) i else 1;


 <<O>>  Difference Topic NiceVersusScala (r1.16 - 11 Feb 2004 - IsaacGouy)
Changed:
<
<

Nice Yes Yes No Yes No Yes
>
>

Nice Yes NA NA Yes No Yes
Added:
>
>

Paradoxically, Nice's syntax is closer to Java, and Nice more effectively reuses Java libraries, but in a fundamental way Scala is more like Java - it's based around classes.


 <<O>>  Difference Topic NiceVersusScala (r1.15 - 27 Jan 2004 - DanielBonniot)
Changed:
<
<

var i = 1;

>
>

int i;


 <<O>>  Difference Topic NiceVersusScala (r1.14 - 27 Jan 2004 - IsaacGouy)
Changed:
<
<

Nice Multi Methods Monomorphic (at present) No String & ?String No Yes
>
>

Nice Enum Classes & Multi Methods Monomorphic (at present) No String & ?String No Yes

 <<O>>  Difference Topic NiceVersusScala (r1.13 - 26 Jan 2004 - IsaacGouy)
Added:
>
>

This at a glance comparison is based on Scala version 1.0.0-b6 and Nice version 0.9.6

Changed:
<
<

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.

>
>

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.

Added:
>
>

Someone with a better understanding of type systems could comment here

Added:
>
>

Of course, both Scala and Nice have other interesting features.

Changed:
<
<

Made a few additions -- ArjanB - 24 Jan 2004

>
>

Opinion

Nice Option Types seem to have found a middle course, allowing non-null types to be distinguished without making them harder to use when a value may be null.
Changed:
<
<

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.) -- IsaacGouy - 24 Jan 2004

>
>

Every Scala expression has a value, so there are fewer explicit return statements - I'm familiar with that from Smalltalk, so it's difficult to judge if I just like it because it's familiar. In some cases Scala syntax seems more consistent; Nice seems to extend Java and so add syntax. For example, def square(x: Int) = { var y=x; y*y } and def square(x: Int) = x*x; whereas Nice has int square(int x){ var y=x; return y*y; } and a shorthand form int square(int x) = x*x;

-- IsaacGouy - 26 Jan 2004 (thanks Arjan)


 <<O>>  Difference Topic NiceVersusScala (r1.12 - 26 Jan 2004 - IsaacGouy)
Changed:
<
<

Scala Yes ? Yes ? No
>
>

Scala Yes No Yes ? No

 <<O>>  Difference Topic NiceVersusScala (r1.11 - 26 Jan 2004 - ArjanB)
Added:
>
>


Added:
>
>

Changed:
<
<

>
>


Added:
>
>


 <<O>>  Difference Topic NiceVersusScala (r1.10 - 25 Jan 2004 - IsaacGouy)
Changed:
<
<

Nice Yes No No Yes No Yes
>
>

Nice Yes Yes No Yes No Yes

 <<O>>  Difference Topic NiceVersusScala (r1.9 - 25 Jan 2004 - IsaacGouy)
Changed:
<
<

Nice Yes Yes No Yes No Yes
>
>

Nice Yes No No Yes No Yes
Changed:
<
<

Nice Yes Yes Yes(2) Yes Yes Yes
>
>

Nice Yes Yes Not yet completed Yes Yes Yes
Deleted:
<
<

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

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


 <<O>>  Difference Topic NiceVersusScala (r1.8 - 24 Jan 2004 - IsaacGouy)
Changed:
<
<

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.

>
>

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.


 <<O>>  Difference Topic NiceVersusScala (r1.7 - 24 Jan 2004 - IsaacGouy)
Changed:
<
<

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.

>
>

There are also fundamental differences: Scala has far less in common with Java (Scala targets CLR as-well-as JVM), Scala uses single dispatch, and has a different type system (nuObj).

Changed:
<
<

Nice Yes Yes(1) No Yes No Yes
>
>

Nice Yes Yes No Yes No Yes
Deleted:
<
<

(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

Changed:
<
<

  Use Java classes Parameterize Java classes Subclass Java classes Use in Java Java Statements/Operators
>
>

  Use Java classes Parameterize Java classes Subclass Java classes Subclass in Java Java Statements/Operators
Changed:
<
<

Scala Yes ? Yes Maybe No
>
>

Scala Yes ? Yes ? No
Changed:
<
<

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.

>
>

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 a little more like a Java 2.0 than an entirely new language.

Added:
>
>

Some of these differences can be seen in the following example. In Scala we use a HashMap defined in a Scala library; in Nice we parameterize the Java HashMap. In Scala we use a sequence comprehension; in Nice an extended for statement, or a Java for statement.

Changed:
<
<

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
>
>

Scala Nice
     
import scala.collection.mutable.HashMap;

object hash {
  def main(args: Array[String]) = {
    val n = toPositiveInt(args);
    var count = 0;
    val table = new HashMap[String,Int]();

    for (val i <- Iterator.range(1,n+1)) 
      table += Integer.toString(i, 16) -> i;

    for (val i <- Iterator.range(1,n+1)) 
      if (table contains Integer.toString(i, 10)) 
        count = count + 1;

    Console println(count);
  }

  private def toPositiveInt(s: Array[String]) = {
    val i = 
      try { Integer.parseInt(s(0)); } 
      catch { case e: Exception => 1 }

   if (i>0) i; else 1;
  }

}
 
Deleted:
<
<

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

Changed:
<
<

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

>
>

void main(String[] args){ let n = toPositiveInt(args); var count = 0; HashMap? table = new HashMap?();

for (int i : 1..n) table[ Integer.toString(i, 16) ] = i;

for (int i = 1; i <= n; i++) if (table.containsKey(Integer.toString(i, 10))) count++;

println(count); }

private int toPositiveInt(String[] s){ var i = 1; try { i = Integer.parseInt(s[0]); } catch (Exception e){ i = 1; }

if (i>0) return i; else return 1; }

Other

Methods Pattern Matching Local Type Inference Comprehensions Option Types User Defined Coercions Tuples
Nice Multi Methods Monomorphic (at present) No String & ?String No Yes
Scala Case classes Monomorphic, Polymorphic, Non-Recursive Functions Yes Some(String) & None Yes Library
Changed:
<
<

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.)

>
>

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.) -- IsaacGouy - 24 Jan 2004


 <<O>>  Difference Topic NiceVersusScala (r1.6 - 24 Jan 2004 - IsaacGouy)
Changed:
<
<

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

>
>

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.

Changed:
<
<

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.

>
>

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.

Changed:
<
<

I'd like that! Traits can include method implementations not just declarations (Traits are classes without state)

>
>

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

Changed:
<
<

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

  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

 <<O>>  Difference Topic NiceVersusScala (r1.5 - 24 Jan 2004 - IsaacGouy)
Changed:
<
<

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 uses single dispatch (with traits and mixins).

>
>

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 (with traits and mixins), F Bounded Polymorphism.

Added:
>
>

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.

Added:
>
>

I'd like that! Traits can include method implementations not just declarations (Traits are classes without state)

Changed:
<
<

Java Compatibility

>
>

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

Java Commonality

Added:
>
>

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.

Changed:
<
<

Scala Case classes Yes(3) Yes Some(String) & None Yes As classes in stdlib
>
>

Scala Case classes Yes(3) Yes Some(String) & None Yes Library
Added:
>
>

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

Deleted:
<
<

-- IsaacGouy - 22 Jan 2004

Changed:
<
<

Made a few additions.

>
>

Made a few additions -- ArjanB - 24 Jan 2004

Changed:
<
<

-- 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.)


 <<O>>  Difference Topic NiceVersusScala (r1.4 - 24 Jan 2004 - ArjanB)
Changed:
<
<

  Unified Types Traits Mixins External Methods Inner classes
Nice Yes No No Yes No
Scala Yes Yes Yes No Yes
>
>

  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
Added:
>
>

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

Changed:
<
<

  Anonymous Functions Higher-Order Functions Currying Dynamic Dispatch
Nice Yes Yes No Multiple Dispatch
Scala Yes Yes Yes Single Dispatch
>
>

  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
Changed:
<
<

  Generic Classes Generic Methods Variances Upper Type Bounds Lower Type Bounds
Nice Yes Yes Not yet Yes ?
Scala Yes Yes Yes Yes Yes
>
>

  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 ?
Added:
>
>

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

Changed:
<
<

Methods Pattern Matching Local Type Inference Comprehensions Option Types
Nice Multi Methods Some: Monomorphic Vars No String & ?String
Scala Case classes Yes Yes Some(String) & None
>
>

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 As classes in stdlib
Added:
>
>

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

Changed:
<
<

Does this mean that you want to make the comparison?

>
>

Made a few additions.

Changed:
<
<

-- ArjanB - 22 Jan 2004

>
>

-- ArjanB - 24 Jan 2004


 <<O>>  Difference Topic NiceVersusScala (r1.3 - 24 Jan 2004 - IsaacGouy)
Changed:
<
<

Scala

>
>

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 uses single dispatch (with traits and mixins).

Classes

  Unified Types Traits Mixins External Methods Inner classes
Nice Yes No No Yes No
Scala Yes Yes Yes No Yes

Methods

  Anonymous Functions Higher-Order Functions Currying Dynamic Dispatch
Nice Yes Yes No Multiple Dispatch
Scala Yes Yes Yes Single Dispatch

Type Parameters

  Generic Classes Generic Methods Variances Upper Type Bounds Lower Type Bounds
Nice Yes Yes Not yet Yes ?
Scala Yes Yes Yes Yes Yes

Java Compatibility

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

Other

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


 <<O>>  Difference Topic NiceVersusScala (r1.2 - 22 Jan 2004 - ArjanB)
Added:
>
>

Does this mean that you want to make the comparison?

-- ArjanB - 22 Jan 2004


 <<O>>  Difference Topic NiceVersusScala (r1.1 - 22 Jan 2004 - IsaacGouy)
Added:
>
>

%META:TOPICINFO{author="IsaacGouy" date="1074785426" format="1.0" version="1.1"}% %META:TOPICPARENT{name="LanguageComparisons"}% Scala

-- IsaacGouy - 22 Jan 2004


Topic NiceVersusScala . { View | Diffs | r1.22 | > | r1.21 | > | r1.20 | More }
Revision r1.1 - 22 Jan 2004 - 15:30 GMT - IsaacGouy
Revision r1.22 - 26 Jul 2005 - 07:21 GMT - TWikiGuest
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.