WebLord

WebLord

The Site Construction Power Tool

Inheritance Rules

Yes, it does! ;-)

Inheritance of properties forms one of the central concepts of power behind WebLord. You need to understand this section before being able to exploit WebLord fully!

In fact, make sure you understand the example below!

The following is the sequence in which an object's properties are inherited:

  1. A property of the current object is used first
  2. A property of the parent object(s) is used if the current object does not define the property. Note that private properties are not visible to the children and are not inherited. Private properties are given with an underscore on the property name. See also Defining Objects
  3. The value (or 'then' / 'else') property of an object with the same name as the named property is used if no properties can be inherited.
  4. A property that cannot be resolved in any of the above ways is undefined and evaluates to an empty value (see problems section)

Consider this example:


	site = main {
		pages=	Page1 Page2 Page3;
		title=	"<title>Default Page Title</title>";
	}
	text = funny-title {
		value = "We are NOT eskimos!";
	}
	page = Page1 {
		value=	"<html><head>" title "</head><body>Test for page 1</body></html>";
		title=	"This is a specific title for page #1";
	}
	page = Page2 {
		value = "<html><head>" title "</head><body><est for page 2</body></html>";
	}
	page = Page3 {
		value = "<html><head>" funny-title "</head><body>Test for page 1</body></html>";
	}
	page = Page4 {
		value = "<html><head>" missing-title "</head><body>Test for page 1</body></html>";
	}

What's actually happening with the 'title' properties?

The page object 'Page1' defines a 'title' property, so rule (1) applies and the title is used.

The page object 'Page2' does not define a 'title' property, so rule (1) fails. Rule (2), however applies because the page object's parent (the SITE object 'main') has such an property.

The page object 'Page3' references a 'funny-title' property. It doesn't define this, so rule (1) fails. Rule (2) also fails, because its parent object doesn't define it either. Rule (3), however, succeeds because there is an object by the name 'funny-title'; that object is then evaluated in turn, which results in a title being inherited by Page3.

The page object 'Page4' references a 'missing-title' property. Again, rules (1) and (2) and even (3) fail for the obvious reasons. The result is that Page4 inherits no value for the reference to 'missing-title', so the identifier evaluates to nothing at all.


WebLord is Copyright © 1997 Udo K Schuermann. The latest versions of the software and (this) documentation can be obtained from the WebLord Home Page (the link will only function if you are connected to the internet.) This page has last been updated on Tuesday August 05, 1997.