轻灵,内省,质朴,有为

next-scripting.org : 一个面向对象的框架NSF和具体实现NX

+1 投票

next-scripting.org 提供一个基于Tcl的,面向对象(OO)的框架和扩展。

其中面向对象的框架被叫做NSF (Next Scripting Framework),它提供三种面向对象的实现:

  1. NX
  2. XOTcl
  3. TclCool
NX is a highly flexible, Tcl-based, object-oriented scripting language. It is a descendant of XOTcl and was designed based on 10 years of experience with XOTcl in projects containing several hundred thousand lines of code. While XOTcl was the first language designed to provide language support for design patterns and to provide a highly dynamic programming environment, the Next Scripting Framework (NSF) and NX add to these features support for language-oriented programming.


下面是一个其网站上列出的,用NX定义的Stack的例子:

Code: nx-stack.tcl
nx::Class create Stack {

   #
   # Stack of Things
   #

   :variable things {}

   :public method push {thing} {
      set :things [linsert ${:things} 0 $thing]
      return $thing
   }

   :public method pop {} {
      set top [lindex ${:things} 0]
      set :things [lrange ${:things} 1 end]
      return $top
   }
}

NX继承自XOTcl。

最新提问 9月 4, 2015 分类:应用平台 | 用户: 风行水上 (-30 分)
修改于 9月 4, 2015 用户:风行水上

登录 或者 注册 后回答这个问题。

...