Experimentation Stage

Interfaces

Interfaces are contracts declarations with no implementation.

public interface Validator<in T> {
     public validate( T candidate) : ValidatorResult;
}

Interfaces can extend other interfaces an are implemented by classes or objects.

public let class MailValidator implements Validator<String> {

     public validate( String candidate) : ValidatorResult{
            let result = new ValidatorResult ();

            if (!candidate.indexOf('@').isPresent){
                result.addReason("Invalid email");
            }

            return result;
     }
}

Interfaces can only define public properties and public methods.