evincarofautumn / kitten

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

Top-level definitions are not generalized #68

Closed strager closed 11 years ago

strager commented 11 years ago
def my_id(a -> a):
  ->x
  x

def my_id_alias: my_id

10 my_id sayInt
"x" my_id say

10 my_id_alias sayInt
"x" my_id_alias say

// :10:1: note: Int is from here
// :11:1: note: [Char] is from here
// :11:1: note: Char is from here
// (unknown): type error: cannot solve scalar type constraint [Char] = Int
evincarofautumn commented 11 years ago

They are generalised, but they’re not polymorphic enough. This is related to #58—if you want to apply a function multiple times on different stack types, you currently need to provide a signature so the compiler knows which part of the stack is the “rest”.