H (Hybrid) Language - v0.03, by Dr. Herong Yang
$trim Statement - Detach Objects
This section describes the $trim statement for detaching appended objects from the current object.
The $trim statement for detaching the last appended object from the current object using the following syntax:
$trim object_reference;
Examples of using $trim statements:
$class person: { $instance x: { x.name = "John"; $method x.changeName(newName): { x.name = newName; } } } $class employee: { $instance x: { x.status = "Part-time"; $method x.changeStatus(newStatus): { x.status = newStatus; } } } e = employee(); $append e $with person(); e.changeName("Herong"); e.changeStatus("Full-time"); $trim e; e.changeName("Yang"); # gets UnknowMethod error
Design options:
1. Use $trim as the keyword for detaching objects. This makes the "$trim a" statement more readable.
2. Use $detach as the keyword for detaching objects.
Table of Contents
►Inheritance - Object Attachments
$append Statement - Attach Objects
Name Collision in Attached Objects
Append Multiple Object Attachments
►$trim Statement - Detach Objects
Build Subclasses with Superclasses
Object Morphinism by Changing Attachments