The problem isn't just disambiguation. It's that the syntax I'd love (and see most often in papers) where we name the argument like name:Num is exactly the same as an object contract (since CoffeeScript lets us have implicit braces). I don't think we want to change how object contracts are handled in the contract language so we have to do something else.
@paulmillr I think that syntax would be a bit confusing since in haskell that means to constrain by the typeclass right? Humm...maybe that'd work though. The multi arg would look like:
f :: (Num x, Str y) => (x, y) -> !(result) -> x > result and y > result
Or simpler since => is redundant:
f :: (Num x, Str y) -> !(result) -> x > result and y > result
But now x and y look like type variables instead of just names so probably not what we want.
I think my favorite syntax right now is (Num as x) -> !(result) -> result > x. Thoughts?
Why overcomplicate simple things? If return from 1st func is a param to the 2nd one, same the params of the 1st one should be. Like so:
f:: (Num) ->!(result, params) -> params > result
Using named params (Num as x) is harder to maintain, because you can define 2nd function as generic one and use it with many others. Then, you would have to maintain same param name in all of these functions.
I'm not too happy with the syntax we have for dependent contracts right now.
Scope of $1 is not obvious and its a bit to magical. Would love to allow explicit naming:
But this conflicts with object contracts (and I don't think this can be disambiguated). Some other ideas that have been bouncing around:
The text was updated successfully, but these errors were encountered: