Created
July 14, 2012 08:11
-
-
Save vasily-kirichenko/3109998 to your computer and use it in GitHub Desktop.
Contracts in Nemerle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person | |
{ | |
public Name: string; | |
public this(name: string) | |
requires name != null | |
{ | |
Name = name; | |
} | |
} | |
// causes nice "Nemerle.Core.AssertionException: assertion ``name != null'' | |
// failed in file Main.n, line 105: The ``Requires'' contract of method `.ctor' has been violated." | |
def person = Person(null); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment