Advanced Computing Environment
Hosted by SourceForge
brix-os project page

Previous: Slots ----- Up: Contents ----- Next: Constructors


Methods are nothing more than functions with a hidden parameter to a receiver object. The `private flag makes the method only accessible by other methods in the type. The `shadow flag is only available for implementations and can not be used for interfaces as it has no meaning. The RECURSE and RETURN extensions may be used in methods.

flags METHOD name (parameters) -> rtype body
  • name -- method name
  • parameters -- parameter list, parentheses required even when empty
  • -> -- required syntax when return type is given
  • rtype -- return type or list of return types, optional
  • body -- single or block expression
  • `private -- optional flag to make method private
  • `override -- optional flag to override a parent method
  • `final -- optional flag to prevent overriding in subtypes
  • `shadow -- optional flag to make a shadow method -- Shadow Extensions

See the Slots page for a method definition and usage example.

Using Properties
All public type properties, including Self, are available for method parameter types. They are also available within the method body but must be prefixed with the $ operator.

	Foo := deftype (T:Type) {
	  method getType() return $T
	  method getSelf() return $Self
	  method getObjects(obj:Self) return (self, obj)

Previous: Slots ----- Up: Contents ----- Next: Constructors