mfichman / jogo

High(er) performance compiled programming language with clean, powerful syntax
MIT License
6 stars 1 forks source link

Function values #71

Open mfichman opened 11 years ago

mfichman commented 11 years ago

Allow function values, like Python does. Bound function values:

Car < Object {
    name String
    foo() { Io::println(self.name) }
}

x = Car()
f = x.foo
f() # Prints the name

Unbound function values:

x = Car()
f = Car.foo
f(x) # Prints the name (requires arg)

Both of these can be implemented with closures.