erlang generator modified : can use class as struct