On Fri, Feb 20, 2015 at 1:00 AM, Keean Schupke <[email protected]> wrote:
> There is no reason not to specialise a function with different arities. > Based on the subtype relation you can have: > > f x y = x + y > > Would get the inferred type: fn 'a -> fn 'a -> 'a, so you can use it in a > curried way if you like, but if you supply both arguments you can > specialise the definition to the least general subtype, IE: fn 'a 'a -> 'a. > So first, I assume this is a function definition? I am reading it as: def f x y = x + y If so, then what you say is correct from the perspective of type theory, but untenable from the standpoint of a systems programming language. This is true because your proposal introduces ambiguity about allocation during application, which is not OK. You have given a very nice illustrating example for why higher-order languages have not penetrated in systems problems. The example is simple enough to understand your type theory proposition, and just complicated enough that we can walk through the consequences to understand why from a systems language perspective it's a non-starter. shap
_______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
