Biterider or Homer,
  Could either one of you provide an example of UserMethod usage, what would be a typical usage for one?
  Thanks in advance,
Posted on 2007-12-28 23:53:28 by rags
Hi Rags!
UserMethod is designed to simply expose a method that is written in another module so that all other methods in the source module know about it. A typical use is for a plug-in, where the implementation is completely separated from the object definition.
Maybe Homer has an example? If not, I can try to write one.


Posted on 2007-12-29 05:03:47 by Biterider
Hi - UserMethod simply describes a procedure - its not a true method, because the first parameter is NOT a secret pointer to 'this class object' - its MERELY a procedure.
Why bother?
Because some procedures are very much related to a class, but act only as a callback interface for external code to call into...and in this way, the caller may be unaware of the exact nature of the interface whose member is being called ... think of the classic windows callback procedure and you can see what I mean.
The first parameter (if any) MIGHT be a pointer to a class object, but that is completely up to the developer.
It was a reactionary addition designed to flag a procedure as 'belonging' to a code module, without necessarily being a central part of it, making it perfect for things like parallel threads, I'm sure you can think of other uses which are module-oriented too.
Make no mistake - this is a cheesy wrapper for a vanilla proc, whose name is ClassName__UsermethodName and whose parameters are as described.
I am not sure if the implementation allows it, but my wish was that by defining the procedure via this mechanism, that it can be redefined/overridden etc... benefitting from the OA32 framework's inheritance mechanism, but retaining the complete flexibility of a procedure, ostensibly through the use of the $MethodAddr macro or similar means.
Posted on 2007-12-29 08:30:36 by Homer
Thanks for the information Biterider and Homer.
Happy New Year to the both of you.
Posted on 2007-12-29 09:43:07 by rags