Chapter 5. The Dynamic Type and Properties

A magic type.

The Dynamic type is a type with a special behavior. Through this chapter you will learn why, how you can use it, and also what you should pay attention to. Understanding the Dynamic type is a key point in mastering haXe.

We have already been introduced to haXe's typing system. But in this chapter we will learn about something new in this typing system: the Dynamic type. The Dynamic type is a type that introduces a very special behavior that we will now study.

In this chapter we will:

  • Use Dynamic variables
  • Learn about Dynamic's pitfalls
  • Learn about the parameterized Dynamic class
  • Implement Dynamic in a class
  • Learn about the use of properties in classes
  • Implement properties in classes

Let's get started.

Freeing yourself from the typing system

The goal of the Dynamic type is to allow one to free oneself from the typing system. In fact, when you define a variable as being a Dynamic type, this means that the compiler won't make any kind of type checking on this variable.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.218.221