Thursday, January 29, 2015

Essential Language Features

Added a static page called Essential Features. It attempts to describe on a single page what characterizes the Tuplex language - it's raison d'ĂȘtre so to speak!

Not all of them will be properly supported in the initial versions, but most are under way.

Currently I'm working with the generics implementation. It has turned out that even for doing a basic thing like a printf-style function, a lot of core semantic and code generation systems are needed.

Consider a simple String type:

public type String<L> derives Array<Char,L> {

  public static func length() UInt { return L }

  public func is_empty() Boolean { return self[0] == 0 }

}


It's just a handful of lines, but it requires a working version of all these systems, and generics is the one that isn't sufficiently capable yet:
  • Symbol tables and namespaces
  • Arrays
  • Objects
  • Static and non-static (instance) fields and methods
  • Inheritance/polymorphism
  • Generics (parameterized types)

Note btw how the length() method is both static and constant. In Tuplex the length is part of the array type, so it can be statically determined. In fact, type parameters are accessible directly (and why shouldn't they be, the information is there anyway!) so the method can be circumvented entirely:

  mystring := "foo"
  print( mystring.L )
--> 3

Thursday, January 15, 2015

Hello World

It's mandatory. This is what a hello world program currently looks like in Tuplex:


main() {
  tx.c.puts("Hello, world!");
}