Wilde is a programming language designed to incorporate the reliability of functional programming with the ease of scripting languages such as Python, and the simplicity of Lisp.
It combines the best aspects of functional and object oriented languages.
NOTE: Currently, the compiler is in a 'developmental' state - so many features are partially complete, or not implemented at all (or, as is most often the case, implemented buggily). All code listed here should run, unless stated otherwise.
Some of Wilde's core features are:
- Function purity - no side effects
- Object oriented - everything is an object
- Immutability - values cannot be changed
Hello world example:
do println("hello, world")
do is a keyword. Here is a list of all keywords:
do- perform I/O action
fn- create a method
return- return a value from a method
=- create an object
:- extend object
:=- create an object and override property
How Wilde works
In Wilde, everything is an object - a set of properties.
Objects are created by extending other objects, using the
: operator. The root object is called
myExtendedObj = object: hello = "world" do println(myExtendedObj.hello)
If you want to override a property, use
baseServer = object: host = "127.0.0.1" port = 3000 myServer = baseServer: port := 8080 do println(myServer.port)
Functions are defined as follows:
fib = fn(a): return a * 2 do println(fib(3))
Impure functions use
do, and are not actually run until they themselves are called with
sayHi = fn(): do println("hi there") sayHi()
sayHi = fn(): do println("hi there") do sayHi()
This enables very convenient purity.
** EXTREMELY buggy
n = object: val = 4 _*_ = fn(b): return b.val * this.val m = n: val := 9 do println(n * m)
In the future, a
_call_ method will also be available, to allow stuff like:
i = object: _call_ = fn(): do println("called i") do i()
Status of TypeChecking
While Wilde feels like a very dynamic language, it is completely typechecked at runtime.
Some aspects are not yet implemented, e.g. this currently fails, though in the future it should typecheck:
m = fn(a): return a: v = "hi" x = object: name = "hmm" w = m(x) do println(w.name)
I think Wilde has great potential.
If I were to spend more time on it, I would probably have to rewrite the compiler using everything I've learned from this iteration (this is, obviously, my first language), add concurrency, compile to C, e.t.c.
Hello Archie! Could you please edit the post and mention your teammates since the jam required you to work in a team of at least 2 members?