News for hackers. Stuff that matters.
Re:Loyal Opposition to Const, Private, Freeze, Non-Configura... by lincolnq on Wednesday November 02, 2011 @09:46PM (#3189822)
Thanks. Contracts are an AWESOME idea and I would love to see them make it into a language that everyone uses.

The ideas behind powerful contracts / type systems have been around for a long time: provide properties that are checked such that you can rely on them.

It seems an interesting and difficult problem to try to add a general enough contract system to javascript, which would support things like const and private and "account balance is always positive". But I think that if done well, it would be the single defining feature which would draw me into using a language. Man, would that be awesome.

Re:Loyal Opposition to Const, Private, Freeze, Non-Configura... by disnet on Thursday November 03, 2011 @06:36PM (#3193985)
Not sure if const/private are a good fit for contracts but things like "account balance is always positive" can be done right now with contracts.coffee using object invariants. For example, verifying the invariants of a binary search tree hold [1].

[1] http://disnetdev.com/contracts.coffee/#duck

Re:Loyal Opposition to Const, Private, Freeze, Non-Configura... by lincolnq on Friday November 04, 2011 @10:22AM (#3196138)
You just made me look seriously into coffeescript. Thanks!