Fancy (programming language)

Fancy is a pure object-oriented programming language that is heavily influenced by Smalltalk and Ruby. The language is currently under development as an open source project by Christopher Bertels.

Development

The language has been in development since the beginning of 2010. As of now, there have been 3 releases of Fancy: v0.1.0, v0.1.1, and v0.2.0. The next expected version, v0.3.0, would be the first official release of the language that runs on Rubinius (an programming environment designed to run Ruby code). This new release with Rubinius integration will support Seamless integration of Ruby libraries. The author plans to add future support of concurrency(Actor model based), and runtime inspection of method calls.

Language Characteristics

Fancy is meant to be a dynamic language. That is, it will execute tasks at runtime that other languages would perform during compilation. Fancy is a garbage-collected language, like Java. The goals of Fancy as a programming language are to be easily understood to programming beginners, and to perform well enough to be used as a scripting language in Unix environments

Fancy and Ruby

Fancy is implemented on top of Rubinius, the Ruby VM, and therefore integrates well with Ruby. Since Fancy is built on Ruby objects, the authors decided to allow access to the original Ruby classes by using a different syntax. For this reason, Fancy can be extended easily to use Ruby libraries, or any of the C-extensions that are native to Ruby. Recently, a Ruby Gem was released for automated installation of the language.

Author

Christopher Bertels is a Computer Science and Philosophy student at the University of Osnabruck in Germany. He has been working on the Fancy language for around a year, and has spoken AbOUT Fancy at the 2010 Ruby and Rails European conference and the Emerging Languages Camp at OSCON.

Features

Fancy's current revision includes:

  • Class definitions that, when nested, work like submodules
  • Loop-, Iteration- & common Collection methods
  • Anonymous functions / Closures (Blocks)
  • A simple package management system, similar to RubyGems
  • Simple pattern matching
  • Easy reflection (as in Ruby)
  • Literal support for Regular Expressions, Arrays, Tuples, Hashes (Dictionaries), Blocks, Integers, Floats, Symbols, (Multiline) Strings and more
  • Exception Handling
  • A bootstrapped (self-hosted, completely in Fancy written) compiler for generating Rubinius bytecode
  • Easy integration with Ruby: Calling out to any Ruby libraries that run on Rubinius, including most C-extensions

Implementation

The implementation of the current release is a runtime using the Rubinius virtual machine, meaning that the language is running on the same platform as Ruby, and is accompanied by a self-hosted (bootstrapped compiler) that generated Rubinius bytecode. To allow more simple cross-platform development, nearly all of the standard library is written in Fancy itself.

Examples

Description

Syntax

Simple print

 "hello world!" println

Looped print 5 times

 5 times: { "hello world!" println }

Calling methods

 var method1: param1 . method2

Calling Ruby methods

 var ruby_method1(param1) ruby_method2()

Class Definitions

 class Person {
   read_write_slots: ['name, 'age, 'country]
   "Creates a new Person instance with the given name, age and country."
   p = Person new
   p name: name
   p age: age
   p country: country
   p  
 }

Nested classes

 class Outer {
   class Inner {
     class InnerMost {
       def football {
         "football"
       }
     }
   }
 }
 instance = Outer Inner InnerMost new
 instance football println