Fancy (programming language)
Encyclopedia
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.
language, like Java
or Ruby
.
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.
, 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.
) that generated Rubinius
bytecode
. To allow more simple cross-platform development, nearly all of the standard library is written in Fancy itself.
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...
programming language that is heavily influenced by Smalltalk
Smalltalk
Smalltalk is an object-oriented, dynamically typed, reflective programming language. Smalltalk was created as the language to underpin the "new world" of computing exemplified by "human–computer symbiosis." It was designed and created in part for educational use, more so for constructionist...
and Ruby
Ruby (programming language)
Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto...
. 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 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.. Thus Fancy supports seamless integration with Ruby and any Ruby libraries.Language characteristics
Fancy is a dynamic programming language. Meaning it will execute tasks at runtime that most languages would perform during compilation. Fancy is a garbage-collectedGarbage collection (computer science)
In computer science, garbage collection is a form of automatic memory management. The garbage collector, or just collector, attempts to reclaim garbage, or memory occupied by objects that are no longer in use by the program...
language, like Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
or Ruby
Ruby (programming language)
Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto...
.
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
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...
environments.
Fancy and Ruby
Fancy is implemented on top of RubiniusRubinius
Rubinius is an alternative Ruby programming language implementation created by Evan Phoenix. Based loosely on the Smalltalk-80 Blue Book design, Rubinius seeks to"provide a rich, high-performance environment for running Ruby code."-Goals:...
, 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
- 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 bootstrappedBootstrapping (compilers)In computer science, bootstrapping is the process of writing a compiler in the target programming language which it is intended to compile...
(self-hostedSelf-hostingThe term self-hosting was coined to refer to the use of a computer program as part of the toolchain or operating system that produces new versions of that same program—for example, a compiler that can compile its own source code. Self-hosting software is commonplace on personal computers and larger...
, completely in Fancy written) compilerCompilerA compiler is a computer program that transforms source code written in a programming language into another computer language...
for generating Rubinius bytecodeBytecodeBytecode, also known as p-code , is a term which has been used to denote various forms of instruction sets designed for efficient execution by a software interpreter as well as being suitable for further compilation into machine code... - 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 compilerBootstrapping (compilers)
In computer science, bootstrapping is the process of writing a compiler in the target programming language which it is intended to compile...
) that generated Rubinius
Rubinius
Rubinius is an alternative Ruby programming language implementation created by Evan Phoenix. Based loosely on the Smalltalk-80 Blue Book design, Rubinius seeks to"provide a rich, high-performance environment for running Ruby code."-Goals:...
bytecode
Bytecode
Bytecode, also known as p-code , is a term which has been used to denote various forms of instruction sets designed for efficient execution by a software interpreter as well as being suitable for further compilation into machine code...
. 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 |