Move logo

Move is a modern and simple programming language which can run on virtually any computer. Move is primarily aimed towards people not previously familiar with programming computers.

logo.png logo.pdf (for high-resolution work)
Disable this fancy context menu

Move standard library

Built-in objects and functions

Number

Number.prototype

Object

Object.prototype

Array

Array.prototype

Text

Text is an alias for the JavaScript built-in type String and is the object prototype used for text values. The use of Text in favor for String is recommended but not enforced.

Text.prototype

Function

Function.prototype

Example: undefined John

foo = ^{ print @name }
foo {}
foo.call {name: "John"}

Date

Date.prototype

RegExp

RegExp.prototype

Boolean

JSON

Move

Move houses the Move runtime library. All members of Move are available directly (i.e. access by “foo” instead of “Move.foo”) and need not be “prefixed”.

create

Example: Cat: I’m furry

animal = { type: "an animal",
           toString: ^{ "I'm " + @type } }
cat = create animal, { type: "furry" }
print "Cat: " + cat

extend

Example: { bananas: ‘yellow’, lime: ‘green’, oranges: ‘orange’ }

fruit = { bananas: "yellow" }
extend fruit, { lime: "green", oranges: "orange" }
print fruit

print

The print function is often overridden in user-specific implementations by simply assigning a custom function, e.g. Move.print = ^{ ...my print logic... }.

repeat

Example: Hello Hello Hello

repeat {times: 3} ^{
  print "Hello"
}

Example 2: Hello in just a second Hello in just a second …

repeat {every: 1000} ^{
  print "Hello in just a second"
}

after

Example: 3 seconds later

after {delay: 3000} ^{ print "3 seconds later" }

after was introduced in Move 0.3.1

class

Creates a “factory” function which creates new objects based on prototypeObject, optionally inheriting from parentFactory.

A Constructor/initializer function can be defined by specifying a “constructor” property on the prototype:

Foo = class {
  constructor: ^{ @dateCreated = Date.now() }
}

If no constructor has been specified for a prototype at the time of factorization, the closest parent constructor (if any) will be invoked:

Foo = class {
  constructor: ^{ @dateCreated = Date.now() }
}
Bar = class Foo, {}
b = Bar()
# b.dateCreated == a Date object

There is very little magic going on here — the resulting prototype is just an object and the constructor is just a value property of the prototype, thus you can change and manipulate those as usual. To call a “parent class’s” constructor, simply:

...
Bar = class Foo, {
  constructor: ^(name){
    Foo.prototype.constructor.apply this, arguments
    @name = name
  }
}
b = Bar("Bardot")
# b.dateCreated == a Date object
# b.name == "Bardot"

This feature relies on compile-time extensions and can be disabled by setting the compiler option runtimeClassCreation to false. It is enabled by default.

class was introduced in Move 0.4.1