Tutorial by Examples

The following abstract defines an EmailAddress type based on the String type which will use a regular expression to validate the passed argument as an e-mail address. If the address isn't valid, an exception will be thrown. abstract EmailAddress(String) { static var ereg = ~/^[\w-\.]{2,}@[\w-\.]...
Operator overloading is only possible with abstract types. The following abstract defines a Vec2i type based on the Array<Int> type. This is a two-component vector with integer values. Operator overloading is made possible my the @:op compiler metadata. Only the available numeric operators ca...

Page 1 of 1