#!/usr/local/bin/rune -x # # Demonstrate the use of lvalue scope. lvalue scope may be applied # to individual procedural arguments or to the return value. It # causes the caller to pass the object by reference instead of by # value, allowing the procedure to modify the contents of the # object. # # This feature is most often used when implementing operators that # require lvalues, such as "++" and "&=", but it can be used to # great effect with normal procedures as well. import "sys"; import ; class Fubar { Fubar *next; destructor method void shootme() { this.next = NULL; } } Fubar Fu; Fubar *root = &Fu; int main(int ac, char **av) { Fubar *fu; fu = root->next; stdio.stdout->format("abc" "def\n"); stdio.stdout->format("%s\n", `xxxyyy"abc"'xyz'\n` "qqq\n"); stdio.stdout->format(`"abc" "def\n"` "\n"); fu.new(); fu->next.new(); }