# With the eval/macro interpreter, can I hotpatch new methods into a class at runtime?

**URL:** https://community.haxe.org/t/with-the-eval-macro-interpreter-can-i-hotpatch-new-methods-into-a-class-at-runtime/4790
**Category:** Haxe
**Created:** [March 16, 2026, 12:39am UTC](https://community.haxe.org/t/with-the-eval-macro-interpreter-can-i-hotpatch-new-methods-into-a-class-at-runtime/4790 "2026-03-16T00:39:15Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![davidgiven](https://community.haxe.org/user_avatar/community.haxe.org/davidgiven/32/1326_2.png) [@davidgiven](https://community.haxe.org/u/davidgiven)
#### Post date: [March 16, 2026, 12:39am UTC](https://community.haxe.org/t/with-the-eval-macro-interpreter-can-i-hotpatch-new-methods-into-a-class-at-runtime/4790/1 "2026-03-16T00:39:15Z")

</div>

Objective C allows this, and it’s incredibly useful for certain esoteric things — for the use case I have in mind, testing. Does the haxe eval/macro runtime allow this kind of run-time system manipulation?

---

<div class="post-metadata">

### Author: ![back2dos](https://community.haxe.org/user_avatar/community.haxe.org/back2dos/32/30_2.png) [@back2dos](https://community.haxe.org/u/back2dos)
#### Post date: [March 16, 2026, 7:27am UTC](https://community.haxe.org/t/with-the-eval-macro-interpreter-can-i-hotpatch-new-methods-into-a-class-at-runtime/4790/2 "2026-03-16T07:27:54Z")

</div>

It’s not really exposed (in theory it would be possible though).

You have a bunch of options:

1. make a (global) build macro that either marks methods of interests (i.e. all?) as dynamic or adds some form of indirection that you can leverage at runtime
2. try to replace the methods at compile time (if this is about mocking or something, it’s typically feasible)
