8000 Augments · brombres/Rogue Wiki · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Abe Pralle edited this page Nov 22, 2023 · 5 revisions

Syntax

Augmenting Classes

class XYZ<<$DataType>> ...

augment XYZ [: BaseClassOrAspect, Aspect2, ...]
  # Modifies every template instance (XYZ<<Int32>>, XYZ<<String>>, etc.)
  PROPERTIES
    # Additional properties

  METHODS
    method alpha
      # Adds a new method alpha(). Replaces alpha() if it already exists.

    method alpha [insert]
      # If alpha() already exists, inserts this code at the beginning.
      # If alpha() does not exist, this method is defined as alpha().

    method alpha [append]
      # Similar to [insert] but appends code at the end.
endAugment

augment XYZ<<Int32>>
  # Modifies only the XYZ<<Int32> template instance.
  METHODS
    method alpha [replace]
      ...
endAugment

Batch Augment Syntax

augment
  METHODS
    method TypeName1.alpha(...) ...
    method TypeName2.beta(...) ...
    ...
endAugment

# The above is equivalent to:
augment TypeName1
  METHODS
    method alpha(...) ...
endAugment

augment TypeName2
  METHODS
    method beta(...) ...
endAugment

Augmenting Routines

Augment a routine by writing a new routine definition and giving it the attribute [append], [insert], or [replace]. Any existing routine with a matching signature will be modified or replaced accordingly.

Clone this wiki locally
0