Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

specialization

This notebook introduces :> specialization; after running it you can declare that the whole is a kind of the concept that names it.

The previous notebook declared HeatingSystem and ControlSystem as standalone types with no supertype. This notebook declares Toaster, the actual whole, as a specialization of ToastingSystem: the system that carries out the purpose is a kind of the concept that names it, not the other way around. Toaster’s body (its cycle-time slot and its subsystem parts) is completed in the next notebook.

part def Toaster :> ToastingSystem;

:> declares that every Toaster is a kind of ToastingSystem, inheriting the purpose action ToastBread it performs. The supertype must be in scope: ToastingSystem was declared in notebook 01 and is present in the cumulative model.

Toaster :> ToastingSystem loads with no diagnostics. The next cell checks what happens when the named supertype does not exist.

Expected error: unresolved reference: UndefinedBase

Specializing an undefined type raises an unresolved-reference error, reported in bad.diagnostics[0].

Toaster specializations (1):
  specializes: ToastingSystem -> ToasterDemo::ToastingSystem

toaster.specializations reports the target above, confirming Toaster :> ToastingSystem is recorded, not just parsed.

part def Toaster :> ToastingSystem; printed above loaded without error, and toaster.specializations shows the target reported below, confirming the relationship is now part of the model.

Try the chapter exercise in exercises/ch01/exercise.ipynb: declare that CoffeeMaker specializes BrewingSystem and confirm the specialization records correctly.