Function References - documentation?

Seems to be zero docs on these things:

this.addParams = oauth_add_params

where oauth_add_params is the same name as a function:

Function oauth_add_params(http As Object) As Void

Anyone want to elaborate on how these things work? Is it the underscore that makes it key to the function? Or do we have to be careful not to have variables with the same name as the function?

  • Joel

Ok, no responses?

Well let me rephrase it then: What are the rules for using function references, which are undocumented, for the most part, in the Brightscript manual, but are heavily used in the examples?

Anyone who’s used them care to comment? Of course, from the examples, it looks easy enough, right, but I really don’t like working in the dark. Anyone care to shine a light?

  • Joel

There’s no magic to the name of the function. You can specify any function as a method of an “object” in BrightScript. This actually harkens back to the m. scope discussion we had awhile back. In the case of a function reference like this, the “m.” object references the object the method is defined on, instead of the global “m.”.

It’s similar to prototyping in javascript, if that helps.

It’s the type value in the name/value pair that makes it a method or a parameter. If the value type is a function it becomes an object method.

–Kevin.