14.16 Active fields

  • Active fields allow you to define components that look like fields from the outside, but are defined with functions, like methods.
  • Implemented using active bindings.
  • Each active binding is a function that takes a single argument value.
  • Great when used in conjunction with private fields.
    • This allows for additional checks.
    • For example, we can use them to make a read-only field and to validate inputs.