Monday, February 02, 2009

What if Groovy has got Structural Typing

Here's a quick mock class after I've been reading this entry.

class G7Greeter {

  def greet(String who, {def setOutput(String text)} model) {
    println "Hello from G7 ${who}"
    model.output = "Hello from G7 ${who}"
  }

}


It would be great if Groovy has Scala's structural typing feature. Structural typing is good for statically "duck typing"-like behaviour. But it seems we need a fork as Groovy dynamic typing allows multi-dispatch already.

Monday, January 12, 2009

Fortress Summary

This is a summary from Fortress Language Specification 1.0.

Fortress "secure Fortran" in a nutshell.

  • General-purpose
  • Statically typed
  • Component-based
  • Designed for producing robust high-performance software with "high programmability"
  • Intended to be a "growable language"
    • be gracefully extended
    • be scaling to "unprecedented" levels of parallelism and of addressable memory
  • Supports modular and extensible parsing
    • allow new notations and static analyses to be added
  • High-performance computation with abstraction and type safety
  • Support type inference
    • although it's statically and nominally typed
    • types can be omit if they are clear in the context
    • types can be parametric
  • Functions are first-class values
  • Components in Fortress are defined as entities with export and import APIs (not in general compared with the same term of Scala)
  • Built-in parallel computation support for large scale data structures, e.g. for loop is parallel by default
Modular Concerns
  • Object and Trait
    • an object consists of fields and methods
    • traits are named constructs that declare sets of methods. This concept is from Self.
      • method in traits may be abstract or concrete
      • trait may extend other traits
      • trait provides inherited methods as well as those declared in its declaration.

Sunday, January 11, 2009

Scala Summary

I have been reading Scala papers for a couple of days. Here's a quick summary from the first section of "An overview of the Scala programming language":

  • Scala fuses OOP and functional programming together.
  • Scala has been designed for construction of components and component system, which is a goal of software industry.
  • Components can be in any form, any size. Classes, libraries, frameworks, or processes can be considered as components.
  • Most existing languages offer only limited level of abstraction and composition.
  • The same concept of programming should be scalable to use for small as well as large programs.
  • Scala aims to be scalable by fusing OO and functional features into it.
  • Every value is an object, and every operation is a method call in Scala (uniform object model).
  • Functions are first-class values in Scala.
  • Scala has a unified abstraction for both types and values.
  • Scala provides constructs for composing classes and traits.
  • Scala provides object decomposition using pattern matching.

Thursday, December 11, 2008

Syntax of Type Sheet

It's beautiful, isn't it?

class(C) => { field(f) => f: String; method(m) && args(a) => { // bound a local(v) => v: int; // order of binding -> is left to right local(n) && call(Integer.minus(_)) && this(n) => return: int; call(print(n)) && match(n) { case call(Integer.plus(_)) => n: int; default => n: String; } } }