Fancy

Emerging Languages Camp 2010

Christopher Bertels chris@fancy-lang.org www.fancy-lang.org

Motivation

Many Language implementations
● ● ●

Not very well documented Hard to read and understand if you're new to this stuff Lots of magic

Fancy
● ● ● ●

Focus on documentation for potential language implementors Easy and simple semantics Newcomer friendly Having fun working on the implementation side

Not just as a language end-user

Inspiration

Smalltalk
● ●

Everything's an Object Pure message sending
– –

Small amount of special keywords and syntax Simple message sending semantics

● ● ●

Dynamic, class-based OO Metaprogramming Reflective

Inspiration

Ruby
● ● ● ● ●

File based (instead of image based as Smalltalk) Embrace Unix TIMTOWTDI Similar literal syntax Class definition is executable script

Stuff similar to attr_accessor etc. e.g. Blocks ↔ Procs ↔ Lambdas

But: Fixed some inconsistencies within Ruby

Inspiration

Erlang
● ● ●

Message passing concurrency semantics Light-weight processes Note: Still needs to be implemented

First Class is good
● ●

Classes, Methods, ... e.g. Object Documentation
● ● ●

Classes Methods Tests (Runnable Documentation)

FancySpec

Simplified clone of RSpec

~ 100 lines of Fancy

● ●

Tests for all built-in classes & methods Not dependent on implementation

FancySpec

Classes & Methods

Blocks

Ruby has some weird inconsistencies

Example: Symbol to Proc

Some other features
● ● ●

Dynamic scoping Simple method caching Define logic based on sender of the message

e.g. private, protected & public methods Currently uses C++'s mechanisms in the background :(

Exception Handling

Current Stats and Goals
● ●

~ 9k LOC C++ ~ 3k LOC Fancy
● ●

~ 1600 LOC Stdlib in Fancy ~ 1500 LOC FancySpecs As much in Fancy as possible Be reasonably fast (getting there) Be easy to understand & well documented

Small native core
● ● ●

Coming soon

Running on Rubinius VM
● ●

Self-hosting compiler written in Fancy Message passing concurrency using Rubinius' channels Continuations

Restarts, Signals, Exception Handling ...

It's a nice fit semantically

Summary
● ● ● ●

Simple and small language implementation Easy to get started with It's fun @emerginglangs rocks!

http://fancy-lang.org http://github.com/bakkdoor/fancy #fancy @ irc.freenode.org

Sign up to vote on this title
UsefulNot useful