Index: Makefile.in =================================================================== diff -u -rec6103aa46641ff9e17376e43be45693e617d527 -rc7738a386075dae91fb88e6a93232f37dfedc228 --- Makefile.in (.../Makefile.in) (revision ec6103aa46641ff9e17376e43be45693e617d527) +++ Makefile.in (.../Makefile.in) (revision c7738a386075dae91fb88e6a93232f37dfedc228) @@ -260,7 +260,8 @@ $(src_doc_dir)/example-scripts/rosetta-multiple-distinct.html \ $(src_doc_dir)/example-scripts/rosetta-add-variable.html \ $(src_doc_dir)/example-scripts/rosetta-clone.html \ - $(src_doc_dir)/example-scripts/rosetta-multiple-inheritance.html + $(src_doc_dir)/example-scripts/rosetta-multiple-inheritance.html \ + $(src_doc_dir)/example-scripts/rosetta-single-inheritance.html %.html : %.tcl $(TCLSH) $(src_app_dir_native)/utils/source-doc-beautifier.tcl $< @@ -594,6 +595,7 @@ $(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-add-variable.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS) $(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-clone.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS) $(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-multiple-inheritance.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS) + $(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-single-inheritance.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS) test-xotcl: $(TCLSH_PROG) $(TCLSH) $(xotcl_src_test_dir)/testo.xotcl -libdir $(PLATFORM_DIR) $(TESTFLAGS) Index: TODO =================================================================== diff -u -r30b4159a5d56ec33b5ee6396a2f55ce48da8e6b4 -rc7738a386075dae91fb88e6a93232f37dfedc228 --- TODO (.../TODO) (revision 30b4159a5d56ec33b5ee6396a2f55ce48da8e6b4) +++ TODO (.../TODO) (revision c7738a386075dae91fb88e6a93232f37dfedc228) @@ -5870,6 +5870,8 @@ ConvertToNothing to match the intended semantics and to avoid false warnings (e.g., missing type=virtualobjectargs type checker) +- Added Rosetta example: https://rosettacode.org/wiki/Inheritance/Single + ======================================================================== TODO: @@ -5890,9 +5892,6 @@ - Add Rosetta examples: - (for the sake of completeness) - https://rosettacode.org/wiki/Inheritance/Single - (more substantial) https://rosettacode.org/wiki/Active_object Index: doc/example-scripts/rosetta-single-inheritance.html =================================================================== diff -u --- doc/example-scripts/rosetta-single-inheritance.html (revision 0) +++ doc/example-scripts/rosetta-single-inheritance.html (revision c7738a386075dae91fb88e6a93232f37dfedc228) @@ -0,0 +1,788 @@ + + + + + +Listing of doc/example-scripts/rosetta-single-inheritance.tcl + + + + + +
+
+

Rosetta example: Inheritance/Single

+
+

Show a tree of types which inherit from each other. The top of the +tree should be a class called Animal. The second level should have +Dog and Cat. Under Dog should be Lab and Collie.

+ +
+
+
package req nx
+
+nx::Class create Animal
+nx::Class create Dog -superclasses Animal
+nx::Class create Cat -superclasses Animal
+nx::Class create Collie -superclasses Dog
+nx::Class create Lab -superclasses Dog
+

Show the resulting class search order:

+
+
+
% Lab info superclasses -closure
+::Dog ::Animal ::nx::Object
+% [Collie new] info precedence
+::Collie ::Dog ::Animal ::nx::Object
+
+
+
+

+ + + Index: doc/example-scripts/rosetta-single-inheritance.tcl =================================================================== diff -u --- doc/example-scripts/rosetta-single-inheritance.tcl (revision 0) +++ doc/example-scripts/rosetta-single-inheritance.tcl (revision c7738a386075dae91fb88e6a93232f37dfedc228) @@ -0,0 +1,23 @@ +# +# == Rosetta example: Inheritance/Single +# +# Show a tree of types which inherit from each other. The top of the +# tree should be a class called Animal. The second level should have +# Dog and Cat. Under Dog should be Lab and Collie. +# +# https://rosettacode.org/wiki/Inheritance/Single +# + +package req nx +package req nx::test + +nx::Class create Animal +nx::Class create Dog -superclasses Animal +nx::Class create Cat -superclasses Animal +nx::Class create Collie -superclasses Dog +nx::Class create Lab -superclasses Dog + +# Show the resulting class search order: +? {Lab info superclasses -closure} {::Dog ::Animal ::nx::Object} +? {[Collie new] info precedence} {::Collie ::Dog ::Animal ::nx::Object} +