Haxe Code Cookbook


Overview of Haxe snippets and tutorials tagged with validation.

  • The following EmailAddress Abstract type example is based on the underlying standard String type, but sets the restriction that it can only represent a valid email address. If not, an exception will be thrown.‥

  • Sometimes failed assertion checks make it difficult to tell what went wrong. For debugging the programmer not only wants to know that a check failed, but also why it failed. This macro outputs the values of all sub-expressions.‥

  • Json is quite a strict format. Ensure all comma's and quotes are correct using a macro function, which is executed while compiling.‥