function and closure implemented
ps: i know that memory will leak on throwing exception on constructor,
but i didn't try to catch them, only try to crash the program.