The dynamic keyword

In haXe code you will sometimes meet the dynamic keyword (all in lowercase). It doesn't have a lot of things to do with the Dynamic type and only appears when declaring a function. It does mean that a method can be rebound. That is, it is possible to change the body of the function.

This keyword is necessary because on some platforms, those methods have to be generated in a special way that can induce some cost on performance.

Here is an example of how to declare such a function:

public dynamic function myFunction()
{
   //Do things
}

Get haXe 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.