Book Image

haXe 2 Beginner's Guide

5 (1)
Book Image

haXe 2 Beginner's Guide

5 (1)

Overview of this book

Table of Contents (21 chapters)
haxe 2
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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
}