Hacker News new | ask | show | jobs
by jksmith 5011 days ago
I've always wanted to work with a language that supports contracts (originally Eiffel I guess). Would love to see this hacked into Go. Or maybe I shouldn't turn this into a Go thread and start using Cobra.
2 comments

> I've always wanted to work with a language that supports contracts (originally Eiffel I guess). Would love to see this hacked into Go.

There have been a few attempts to hack (design by) contracts into Perl. Here are some which can be found on CPAN:

* Class::Agreement - https://metacpan.org/module/Class::Agreement

* Class::Contract - https://metacpan.org/module/Class::Contract

* Sub::Contract - https://metacpan.org/module/Sub::Contract

Sub::Contract is my favourite because it's lightweight, pragmatic & with a more Perlish implementation.

If you work with .net, the code contracts project[1] is halfway there: It's quite ugly and they made some design decisions I don't agree with (for the wrong reasons, i guess...), but it has had a tremendous impact on the quality of my code.

http://research.microsoft.com/en-us/projects/contracts/