ColdC: Function/Method Reference: add_method()


LIST add_method(LIST code, SYMBOL name)

This function compiles code (which should be a list of strings) and uses the result as the definition of the method named by the symbol name. If there were errors in compiling, a list of strings describing the errors is returned, otherwise an empty list is returned.

In the future add_method() will accept only a pre-compiled method from compile() instead of a LIST of code.

Examples:

add_method(["echo(\"foo\");"], 'foo)
=> []

add_method(["echo(\"foo\")"], 'foo)
=> ["Line 2: parse error"]


Last Modified on Feb 26 1996
Copyright © 1995, 1996, Brandon Gillespie