Do we want to allow:
mult : Int => Int -> Int; mult x y = x * y;
Currently this will produce an error because mult x y = x * y; is transformed to (lambda_->_ x (lambda_->_ y (_*_ x y))) when the expression is translated from sexp to pexp.
Afficher les réponses par date
Do we want to allow: mult : Int => Int -> Int; mult x y = x * y;
I don't think so. I think we'll want to allow a syntax more like
mult : Int => Int -> Int; mult y = <dosomething>;
but then <dosomething> can't refer to the implicit argument in the normal way because it doesn't have a name (it can still refer to it via macros, since the macros should receive the complete context, including unnamed variables).
We will probably want to allow
mult : Int => Int -> Int; mult (x :: Int) y = x * y;
so as to allow naming the variable, tho we could also provide a special macro `get_anon_var` to get access to an anonymous variable, as in:
mult : Int => Int -> Int; mult y = let x = get_anon_var Int in x * y;
In any case, currently our macros don't really have access to the context, so we need to improve our infrastructure (mostly: provide accessors to the context, as well as provide ways for a macro to build&return a specific Lexp rather than a Sexp) before such things can be implemented.
Stefan