function references should save to the class environment.
change: import function has been added.
change: would be better to swap global function require with halo function import.
change: to use rawget/rawset API for reduce overhead.