Skip to content

Instantly share code, notes, and snippets.

@vasily-kirichenko
Created July 14, 2012 08:11
Show Gist options
  • Save vasily-kirichenko/3109998 to your computer and use it in GitHub Desktop.
Save vasily-kirichenko/3109998 to your computer and use it in GitHub Desktop.
Contracts in Nemerle
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