I recently encountered a situation in which specifying a :set function for a defcustom raised a Symbol's function definition is void error.
This is because the :set function relies on another function in the same package, which is not yet loaded when the defcustom is initialized.
The way I handled this is to explicitly define the :initialize function to be custom-initialize-default. Is this the best way? If I wanted to use the :set function for initialization, how best to do that[1]?
[1]: Elisp does have forward declaration AFAIK; declare-function doesn't seem to work for functions in the same file