Home/Examples/examples/extends

examples/extends

3 file(s) under examples/extends

document_grouping.sleela

sleela document_grouping.sleela

inheritance.sleela

sleela inheritance.sleela

README.md

markdown README.md

About this collection

<img align="right" src="https://github.com/mearvk/SLeeLa/blob/master/images/debian/debian-logo.png" width="75" height="75" alt="SLeeLa">

extends examples (syntax 1.10)

Runnable programs for the two meanings of extends. See ../../markdown/EXTENDS.md for the normative spec.

FileShows
inheritance.sleelathe OOD meaning — a class extends a base class; inherited fields and methods, overrides, and a multi-level chain (Dog → Pet → Animal)
document_grouping.sleelathe document meaning — extends to <targets> <grouper>; with all three groupers: linear (linear reals), group, and services (a group behind a Server of Services)

Run

make -C impl                              # build the compiler once
SLEELA_BIN=impl/build/sleela bin/SLeeLa run examples/extends/inheritance.sleela
SLEELA_BIN=impl/build/sleela bin/SLeeLa run examples/extends/document_grouping.sleela

Expected output:

# inheritance.sleela
pet Rex of Sam
Rex fetches for Sam
animal Generic

# document_grouping.sleela
document extends to: 1 linear chain, 1 group, 1 services group

Both require #sleela 1.10. Under #sleela 1.9 or lower, class extends is retained metadata only (historical behavior) and extends to ... is rejected.