Fancy (programming language)

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Fancy
Fancy-Logo.png
Paradigm(s) object-oriented
Designed by Christopher Bertels
Developer Christopher Bertels
Appeared in 2010
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
Filename extension(s) .fy, .fyc, .fancypack
Website www.fancy-lang.org

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]

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]

  1. ^ a b c d e f ”About Fancy.” https://github.com/bakkdoor/fancy/wiki
  2. ^ Christopher Bertels (2011-02-23). "Introduction to Fancy". Rubinius. Retrieved 2013-07-08. 
  3. ^ "Category:Fancy". Rosetta Code. Retrieved 2013-07-08. 
  4. ^ a b c "RubyAndRails". Rubyandrails.eu. 2010-10-22. Retrieved 2013-07-08. 
  5. ^ /. "fancy/README.md at master · bakkdoor/fancy · GitHub". Github.com. Retrieved 2013-07-08. 
  6. ^ "fancy | RubyGems.org | your community gem host". RubyGems.org. Retrieved 2013-07-08. 
  7. ^ "About me – Adztec Independent - Blog". Adztec-independent.de. Retrieved 2013-07-08. 
  8. ^ “Emerging Languages Talk Slides” http://www.fancy-lang.org/blog/2010/07/emerging-languages-talk-slides/
  9. ^ "Fancy: OSCON 2010, The O'Reilly Open Source Convention - O'Reilly Conferences, July 19 - 23, 2010, Portland, OR". Oscon.com. Retrieved 2013-07-08. 
  10. ^ /. "fancy/README.md at master · bakkdoor/fancy · GitHub". Github.com. Retrieved 2013-07-08. 

External links[edit]