evincarofautumn / kitten

A statically typed concatenative systems programming language.
http://kittenlang.org/
Other
1.09k stars 39 forks source link

Can't define "constants" #72

Closed strager closed 11 years ago

strager commented 11 years ago

In this example, I define a typed constant:

def debug(Bool): true

// :1:15: compile error:
// unexpected )
// expecting |, ?, &, base type or ->

Of course, the type annotation should be (-> Bool), but to the programmer it's really just a Bool.

If programmers can give explicit type signatures to expressions and variables (a la Haskell's ::), things become cumbersome:

(xs i #) :: -> Int

(s :: -> Set Int) show

The -> is redundant to the programmer and can be inferred.