On Thu, Oct 13, 2011 at 11:51 AM, Quildreen Motta <[email protected]> wrote: > Contracts would be interesting, but perhaps too expensive? > > fib :: (Number) -> Number > function fib(n) { > return n == 0? 0 > : n == 1? 1 > : fib(n - 1) + fib(n - 2) > } > > or function fib(n Number) -> Number { } > > Not particularly proposing any syntax though. Not particularly keen on using > fixed types though -- as JS is not statically typed and types are not > particularly well defined, definitely not something I'd check for is-a > relationships --, I'd rather go with a predicate functions, but then that's > even more expensive.
Quildreen, Your proposal resembles Waldemar’s guards and trademarks. http://wiki.ecmascript.org/doku.php?id=strawman:trademarks http://wiki.ecmascript.org/doku.php?id=strawman:guards You might consider building on these to make a contracts proposal, separating the signatures from the declarations. Alex’s question is whether some subset of these ideas is suitable for rapid consensus. I will refrain from speculating. Kris Kowal _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

