Fancy (programming language)
| Paradigm(s) | object-oriented |
|---|---|
| Appeared in | 2010 |
| Designed by | Christopher Bertels |
| Developer | Christopher Bertels |
| Typing discipline | strong, dynamic |
| Influenced by | Smalltalk,[1] Ruby,[1] Erlang,[1] Io[1] |
| OS | Unix-like (including Mac OS X and Linux) |
| License | BSD license |
| Usual filename extensions | .fy, .fyc, .fancypack |
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.[1]
Contents |
Development [edit]
The language has been in development since the beginning of 2010 and has changed from a C++-based interpreter to be running on Rubinius, a dynamic bytecode virtual machine and implementation for the Ruby programming language.[2] Thus Fancy supports seamless integration with Ruby and any Ruby libraries.
Language characteristics [edit]
Fancy is a dynamic programming language,[1] meaning that it will execute tasks at runtime that many languages would perform during compilation. Fancy is a garbage-collected language, like Java or Ruby.[3] The goals of Fancy as a programming language are to be easily understandable by programming beginners, and to perform well enough to be used as a scripting language in Unix environments.[4]
Fancy and Ruby [edit]
Fancy is implemented on top of Rubinius, the Ruby VM, and therefore integrates well with Ruby.[4] Since Fancy is built on Ruby objects, the authors decided to allow access to the original Ruby classes by using a different syntax.[5] 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.[6]
Author [edit]
Christopher Bertels is a Computer Science and Philosophy student at the University of Osnabrück in Germany.[7] 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[4] and the Emerging Languages Camp at OSCON.[8][9]
Features [edit]
- Class definitions that are also used as namespaces (via nested classes)
- Loop-, Iteration- & common Collection methods (including next/break)
- 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, Ranges, Hashes (Dictionaries), Blocks, Integers, Floats, Symbols, (Multiline) Strings and more
- Exception Handling
- Dynamically scoped variables (like Common Lisp)
- 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 [edit]
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.[10]
Examples [edit]
| 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
|
References [edit]
- ^ a b c d e f ”About Fancy.” https://github.com/bakkdoor/fancy/wiki
- ^ http://rubini.us/2011/02/23/introduction-to-fancy/
- ^ http://rosettacode.org/wiki/Category:Fancy
- ^ a b c http://rubyandrails.eu/speakers/christopher-bertels
- ^ https://github.com/bakkdoor/fancy/blob/master/README.md
- ^ https://rubygems.org/gems/fancy
- ^ http://www.adztec-independent.de/impressum/
- ^ “Emerging Languages Talk Slides” http://www.fancy-lang.org/blog/2010/07/emerging-languages-talk-slides/
- ^ http://www.oscon.com/oscon2010/public/schedule/detail/15480
- ^ https://github.com/bakkdoor/fancy/blob/master/README.md