Fix enum.jl, and convert to use immutables
Merge pull request #2961 from simonster/enum

Fix enum.jl and convert to use immutables