The accepted answer is great. I +1'd it. I'mI'm offering an alternative that doesn't involve setting POSIX mode:
Here's the technique I've been using to store function state to a file so I can continue it later. The first produces a state dump and the second produces just a list of the variable names.
set 2>/dev/null | while read a; do [[ $a == *=* ]] || break; echo $a; done
set 2>/dev/null | while read a; do [[ $a == *=* ]] || break; echo ${a/=*}; done
Both work by dumping lines until it finds one without an '=' char, which occurs when the first function is listed. The latter crops the assignment off.