Mascara 1.2 - With interfaces
Wednesday, August 19, 2009 at 09:52AM Mascara 1.2 has been released, and supports interfaces, an often requested feature.
They work as you would expect very much like interfaces in Java and C#. Basically they describe a set of methods that any class that implements the interface must provide implementations for.
Interfaces may contain function and getter/setter declarations, but not variables or nested types. (Hence ECMAScript interfaces does not allow constants as in Java). Declaration are just function signatures without a body.
Example:
interface Moveable {
function moveTo(x: int, y:int) : void;
}class DialogBox implements Moveable {
function moveTo(x : int, y:int) : void {
// implementation
}
}
Interfaces can inherit from multiple other interfaces, and classes can implement multiple interfaces.
Syntax is defined in the documentation.
Olav | Comments Off | 
Reader Comments (2)
This tool looks so rad. I hope to actually try and use it soon.
Is there a larger development effort using Mascara (for some corp work) or is the community interest picking up steam?
Any chance of visibility modifiers? Creating closures for this purpose is a mess, I would use Mascara if they just added: private var x so I could avoid the hacky-wacky way this is achieved using closures and self invoking functions..yuck!