Snow

What is Snow?

Snow is a programming language. It is dynamic, object-oriented, function-centered, continuation-based, fast, and very simple. Everything in Snow is an object (except flow control structures), and every object can also act as a function, if needed.

Snow is inspired by marvellous languages such as Ruby, Smalltalk, JavaScript/ECMAScript, and Python. Snow is compiled directly to machine code, which makes it very fast. It is also garbage collected, so you rarely have to worry about cleaning up after yourself. The Snow compiler and runtime are written in C, and are very light-weight.

How can I get it?

The Snow source code is available from GitHub: http://github.com/simonask/snow

Build Instructions

Before you take off

Snow is in a very early stage of development. Currently, it crashes a lot. Here's a list of limitations:

Snow is in no way fit for serious production use of any kind at this time! Basic features do work, though, and we are currently working to extend and polish the basic standard library.

Examples

Hello World!

puts("Hello, World!")

Assignment and functions

a: 123 // Assignment is done with the : operator.
b: 456

// A function taking the argument x and y.
add: [x, y] {
  return x + y
}

puts(add(a, b)) // Outputs 579.

Objects

// Class instantiation is done by
// calling the class like a function:
my_object: Object()

my_object.do_something: {
  .foo: "bar" // .foo is syntactic sugar for self.foo.
  puts(.foo)
}

my_object.do_something()

baz: my_object.foo // baz is now "bar"

Conditions

a: 1

if a = 0
  puts("a is zero")
else
  puts("a is not zero")
end

More examples are available on the examples page.

Features

Functions are objects.
This makes function-oriented programming easy, which often results in shorter, simpler, and more concise code.
Simple, unambiguous syntax.
Snow is very easy to parse, for both computers and humans, without strict limitations to what you can do.
Fast.
Snow is slower than C. However, the developers consider it a bug if a program is slower than the equivalent program written in Ruby or Python. There are currently no benchmarks of Snow, but they will come soon.
Symbols.
Ruby and Smalltalk developers will nod their heads here. Snow symbols are constant, internal strings.
Continuation-based.
All function calls are continuations. You can return a value from the third function call up the stack with a single line of code. This makes everything possible.
Easy binding.
Snow can call C functions directly (using dlopen), keeping the amount of boring boilerplate code at a minimum. This is currently unimplemented.
Duck-typed.
If it walks like a duck and talks like a duck, then Snow isn't going to care if it's a dog, horse, airplane, apple, orange, or indeed a duck.
Mutable.
Everything in Snow can be changed, even the most basic standard library functions. This makes aspect-oriented programming easy.
Parallel.
Snow provides easy and safe parallelization through OpenMP. This is a major design goal, as the number of processing cores in a standard computer will only increase in the coming years, and no impurely functional language makes this easy to work with. This is currently unimplemented.

Projects in development

Flake
The canonical package manager.
Speck
A speccing framework inspired by Ruby's RSpec.

Snow Programming Language © 2009 Simon Ask Ulsnes, Robin Kaarsgaard, Mikael Høilund