From de8fab247bf2f081cf4ab82e8e7752ed017ffe9c Mon Sep 17 00:00:00 2001 From: Michael Frank <55284511+frank-at-adacore@users.noreply.github.com> Date: Thu, 30 Jan 2025 16:20:34 -0500 Subject: [PATCH 1/4] First attempt at hierarchicaly visibility images --- .../04-hierarchical_library_units.rst | 20 +- images/hierarchical_visibility_1.svg | 186 ++++++++++ images/hierarchical_visibility_2.svg | 350 ++++++++++++++++++ 3 files changed, 550 insertions(+), 6 deletions(-) create mode 100644 images/hierarchical_visibility_1.svg create mode 100644 images/hierarchical_visibility_2.svg diff --git a/courses/fundamentals_of_ada/130_program_structure/04-hierarchical_library_units.rst b/courses/fundamentals_of_ada/130_program_structure/04-hierarchical_library_units.rst index ca2185085..e24582690 100644 --- a/courses/fundamentals_of_ada/130_program_structure/04-hierarchical_library_units.rst +++ b/courses/fundamentals_of_ada/130_program_structure/04-hierarchical_library_units.rst @@ -26,10 +26,6 @@ Problem: Packages Are Not Enough Solution: Hierarchical Library Units -------------------------------------- -.. container:: columns - - .. container:: column - * Address extensibility issue - Can extend packages with visibility to parent private part @@ -40,9 +36,21 @@ Solution: Hierarchical Library Units - Extensions all have the same ancestor *root* name - .. container:: column +------------------------------- +Visibility Across a Hierarchy +------------------------------- + +.. container:: overlay 1 + + .. image:: hierarchical_visibility_1.svg + :width: 70% + :align: center + +.. container:: overlay 2 - .. image:: hierarchical_library_units.png + .. image:: hierarchical_visibility_2.svg + :width: 70% + :align: center -------------------------- Programming by Extension diff --git a/images/hierarchical_visibility_1.svg b/images/hierarchical_visibility_1.svg new file mode 100644 index 000000000..4b676c472 --- /dev/null +++ b/images/hierarchical_visibility_1.svg @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + Our_Unit + + Visible Part + + Private Part + + + + Body + In a package, the body sees everything the private part sees,and the private part sees everything the visible part sees. + + + diff --git a/images/hierarchical_visibility_2.svg b/images/hierarchical_visibility_2.svg new file mode 100644 index 000000000..8c79f336c --- /dev/null +++ b/images/hierarchical_visibility_2.svg @@ -0,0 +1,350 @@ + + + + + + + + + + + + + + + + + + + + + + + + + Another package can see our visible part (dependingon where the "with" is), but nothing else. + + Our_Unit + + Visible Part + + Private Part + + + + Body + + Other_Unit + + Visible Part + + Private Part + + + + Body + + In a package, the body sees everything the private part sees,and the private part sees everything the visible part sees. + + + From 716754843b536bc836d56cb5fdeb0d58867eb793 Mon Sep 17 00:00:00 2001 From: Michael Frank <55284511+frank-at-adacore@users.noreply.github.com> Date: Fri, 31 Jan 2025 09:34:34 -0500 Subject: [PATCH 2/4] Clean up the fonts --- images/hierarchical_visibility_1.svg | 48 +++++++++++------- images/hierarchical_visibility_2.svg | 76 ++++++++++++++++------------ 2 files changed, 74 insertions(+), 50 deletions(-) diff --git a/images/hierarchical_visibility_1.svg b/images/hierarchical_visibility_1.svg index 4b676c472..f621cf761 100644 --- a/images/hierarchical_visibility_1.svg +++ b/images/hierarchical_visibility_1.svg @@ -23,9 +23,9 @@ inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" inkscape:document-units="mm" - inkscape:zoom="0.77326038" - inkscape:cx="-20.044994" - inkscape:cy="3.8796763" + inkscape:zoom="1.5465208" + inkscape:cx="391.524" + inkscape:cy="257.35186" inkscape:window-width="1920" inkscape:window-height="1112" inkscape:window-x="-8" @@ -88,13 +88,13 @@ y="173.11121" /> Our_Unit Visible Part Private Part Body In a package, the body sees everything the private part sees,In a package, the body sees everything the private part sees,and the private part sees everything the visible part sees. + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Calibri;-inkscape-font-specification:Calibri;text-align:center;text-anchor:middle;fill:#000000;stroke:#000000;stroke-width:0.052;stroke-dasharray:none" + x="102.55672" + y="135.22664" + id="tspan3">and the private part sees everything the visible part sees. Another package can see our visible part (dependingAnother package can see our visible part (dependingon where the "with" is), but nothing else. @@ -168,13 +172,13 @@ y="173.11121" /> Our_Unit Visible Part Private Part Body Other_Unit Visible Part Private Part Body In a package, the body sees everything the private part sees,In a package, the body sees everything the private part sees,and the private part sees everything the visible part sees. + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Calibri;-inkscape-font-specification:Calibri;text-align:center;text-anchor:middle;fill:#000000;stroke:#000000;stroke-width:0.052;stroke-dasharray:none" + x="102.55672" + y="135.22664" + id="tspan3">and the private part sees everything the visible part sees. Date: Fri, 31 Jan 2025 09:44:26 -0500 Subject: [PATCH 3/4] Font sizing issue --- images/hierarchical_visibility_1.svg | 20 ++++++++-------- images/hierarchical_visibility_2.svg | 36 ++++++++++++++-------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/images/hierarchical_visibility_1.svg b/images/hierarchical_visibility_1.svg index f621cf761..212a2c5f1 100644 --- a/images/hierarchical_visibility_1.svg +++ b/images/hierarchical_visibility_1.svg @@ -161,29 +161,29 @@ y="236.23209">Body In a package, the body sees everything the private part sees,and the private part sees everything the visible part sees. Another package can see our visible part (dependingon where the "with" is), but nothing else. In a package, the body sees everything the private part sees,and the private part sees everything the visible part sees. Date: Fri, 31 Jan 2025 10:41:59 -0500 Subject: [PATCH 4/4] Add third and fourth overlay to hierarchical overview image --- .../04-hierarchical_library_units.rst | 12 + images/hierarchical_visibility_2.svg | 32 +- images/hierarchical_visibility_3.svg | 403 ++++++++++++++++++ images/hierarchical_visibility_4.svg | 384 +++++++++++++++++ 4 files changed, 815 insertions(+), 16 deletions(-) create mode 100644 images/hierarchical_visibility_3.svg create mode 100644 images/hierarchical_visibility_4.svg diff --git a/courses/fundamentals_of_ada/130_program_structure/04-hierarchical_library_units.rst b/courses/fundamentals_of_ada/130_program_structure/04-hierarchical_library_units.rst index e24582690..6192b8758 100644 --- a/courses/fundamentals_of_ada/130_program_structure/04-hierarchical_library_units.rst +++ b/courses/fundamentals_of_ada/130_program_structure/04-hierarchical_library_units.rst @@ -52,6 +52,18 @@ Visibility Across a Hierarchy :width: 70% :align: center +.. container:: overlay 3 + + .. image:: hierarchical_visibility_3.svg + :width: 70% + :align: center + +.. container:: overlay 4 + + .. image:: hierarchical_visibility_4.svg + :width: 70% + :align: center + -------------------------- Programming by Extension -------------------------- diff --git a/images/hierarchical_visibility_2.svg b/images/hierarchical_visibility_2.svg index 6a068a509..66e2da740 100644 --- a/images/hierarchical_visibility_2.svg +++ b/images/hierarchical_visibility_2.svg @@ -23,14 +23,14 @@ inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" inkscape:document-units="mm" - inkscape:zoom="1.5465208" - inkscape:cx="391.52399" - inkscape:cy="253.47218" - inkscape:window-width="1920" - inkscape:window-height="1112" - inkscape:window-x="-8" - inkscape:window-y="-8" - inkscape:window-maximized="1" + inkscape:zoom="3.0930416" + inkscape:cx="-35.078739" + inkscape:cy="290.0058" + inkscape:window-width="1904" + inkscape:window-height="1096" + inkscape:window-x="24" + inkscape:window-y="1518" + inkscape:window-maximized="0" inkscape:current-layer="layer1" showgrid="false" /> Our_Unit + width="50.662464" + height="10.529369" + x="9.5668736" + y="184.56796" /> Body + + + + + + + + + + + + + + + + + + + + + + + + + + + Our child's visible part can see our visible part,and its private part (and body) can see our private part + + Our_Unit + + Visible Part + + Private Part + + + + Body + + Other_Unit + + Visible Part + + Private Part + + + + Body + + + + + In a package, the body sees everything the private part sees,and the private part sees everything the visible part sees. + + + diff --git a/images/hierarchical_visibility_4.svg b/images/hierarchical_visibility_4.svg new file mode 100644 index 000000000..25fca01e7 --- /dev/null +++ b/images/hierarchical_visibility_4.svg @@ -0,0 +1,384 @@ + + + + + + + + + + + + + + + + + + + + + + + + + Our private child can see our private partand visible part from anywhere + + Our_Unit + + Visible Part + + Private Part + + + + Body + + Other_Unit + + Visible Part + + Private Part + + + + Body + + + + + + In a package, the body sees everything the private part sees,and the private part sees everything the visible part sees. + + +