Allows a function to be passed and evaluated in the constructor