somDispatch and somClassDispatch perform method resolution to select a method procedure, and then invoke this procedure on args. The somSelf argument for the selected method procedure (called the target object, below, to distinguish it from the receiver of the somDispatch or somClassDispatch method call) is the first argument included in the va_list, args.
For somDispatch, method resolution is performed using the class of the receiver; for somClassDispatch, method resolution is performed using the argument class, clsObj. Because somClassDispatch uses clsObj for method resolution, a programmer invoking somDispatch or somClassDispatch should assure that the class of the target object is either derived from or is identical to the class used for method resolution; otherwise, a runtime error will likely result when the target object is passed to the resolved procedure. Although not necessary, the receiver is usually also the target object.
The somDispatch and somClassDispatch methods supersede the somDispatchX methods. Unlike the somDispatchX methods, which are restricted to few return types, the somDispatch and somClassDispatch methods make no assumptions concerning the result returned by the method to be invoked. Thus, somDispatch and somClassDispatch can be used to invoke methods that return structures. The somDispatchX methods now invoke somDispatch, so overriding somDispatch serves to override the somDispatchX methods as well.