dcw
dcw

Reputation: 3555

Can Design-by-Contract be applied to dynamic languages as easily/well as to statically-typed ones?

The title pretty much sums up the gist.

I'm interested in whether it is possible to enable/disable contract enforcement(s) when using a dynamic language without running a serious risk of poorly/un-diagnosed failure?

If not, the crux seems (to me) to be that any enforcements are a required part of the component's logic, rather than optional/removable as per the spirit of removability of DbC's enforcements.

Upvotes: 1

Views: 188

Answers (2)

Berlin Brown
Berlin Brown

Reputation: 11734

I believe lisp has a good design by contract framework.

http://www.cl-user.net/asp/OkD82/sdataQkIGW7mlSHARDQ3r-H8X8yBX8yBXnMq=/sdataQu3F$sSHnB==

Upvotes: 2

John Feminella
John Feminella

Reputation: 311496

Not only is it possible, there are real-world implementations of this and they've been around for years. Here's a DbC implementation for Python that's twelve years old, for example.

Upvotes: 3

Related Questions