How to set value directly without using its setter method?

Is it possible to set a value of a variable directly without using its setter method?

Example of what I mean:

class Test {
  static function main() {
    var tb = new TextButton();
    tb.lpad = 20;

class TextButton {
  public var lpad(default, set):Float = 5.0;
  public function new() {}
  public function setLeftPad(value:Float) {
    lpad = value; // How to set lpad without using set_lpad?
    // Extra stuff related but different to set_lpad
  function set_lpad(value:Float):Float {
    trace("set lpad to", value, "Shouldn't be run when setLeftPad() is run.");
    lpad = value;
    // Doing extra stuff etc
    return value;


Sometimes I want to set the value directly without running all the extra stuff that I’ve added in the setter. How would I do this?

Playground link: Try Haxe!


Just add @:bypassAccessor in front of the setting like that : @:bypassAccessor lpad = value


Thanks! that worked.