Skip to content

Commit

Permalink
Working on type flex tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
TobyKLight committed Apr 5, 2024
1 parent 10b9404 commit 49f2da5
Show file tree
Hide file tree
Showing 10 changed files with 1,739 additions and 574 deletions.
6 changes: 3 additions & 3 deletions help/Type Flexibility/Explanation 01 What Is Type Safety.vl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Document xmlns:p="property" xmlns:r="reflection" Id="GE0OthsTGYdLWv982OnAfb" LanguageVersion="2024.6.0-0209-g820e492df4" Version="0.128">
<NugetDependency Id="HbKEvHF3XzdPgKVY9UmW9f" Location="VL.CoreLib" Version="2024.6.0-0209-g820e492df4" />
<Document xmlns:p="property" xmlns:r="reflection" Id="GE0OthsTGYdLWv982OnAfb" LanguageVersion="2024.6.0-0280-g5542bf5529" Version="0.128">
<NugetDependency Id="HbKEvHF3XzdPgKVY9UmW9f" Location="VL.CoreLib" Version="2024.6.0-0280-g5542bf5529" />
<Patch Id="VvmT1hkx7pXLEUEo07dpM8">
<Canvas Id="AfTRYnWJsgiM6vi88SzAml" DefaultCategory="Main" BordersChecked="false" CanvasType="FullCategory" />
<!--
Expand Down Expand Up @@ -124,7 +124,7 @@
</Patch>
</Node>
<Node Bounds="552,768,53,19" Id="LO9s4mdcxaGQTwfrjzlEon">
<p:NodeReference LastCategoryFullName="Main" LastDependency="01 What Is Type Safety.vl">
<p:NodeReference LastCategoryFullName="Main" LastDependency="Explanation 01 What Is Type Safety.vl">
<Choice Kind="NodeFlag" Name="Node" Fixed="true" />
<Choice Kind="OperationCallFlag" Name="FruitList" />
</p:NodeReference>
Expand Down
67 changes: 16 additions & 51 deletions help/Type Flexibility/Explanation 02 Types of Type Flexibility.vl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Document xmlns:p="property" xmlns:r="reflection" Id="JTcN5zD5Up7M6jRRYwByJx" LanguageVersion="2024.6.0-0209-g820e492df4" Version="0.128">
<NugetDependency Id="OHjNVp9cXNzM7WJuYVdltz" Location="VL.CoreLib" Version="2024.6.0-0209-g820e492df4" />
<Document xmlns:p="property" xmlns:r="reflection" Id="JTcN5zD5Up7M6jRRYwByJx" LanguageVersion="2024.6.0" Version="0.128">
<NugetDependency Id="OHjNVp9cXNzM7WJuYVdltz" Location="VL.CoreLib" Version="2024.6.0" />
<Patch Id="NBgiiHFK1DWLrRy5fEb2WM">
<Canvas Id="IiOYzOIsxJ0N2fuvb09WV7" DefaultCategory="Main" BordersChecked="false" CanvasType="FullCategory" />
<!--
Expand Down Expand Up @@ -90,7 +90,7 @@
<p:stringtype p:Assembly="VL.Core" p:Type="VL.Core.StringType">Comment</p:stringtype>
</p:ValueBoxSettings>
</Pad>
<Overlay Id="JIdH46FAnhZQMplYQlEJ9T" Name="" Bounds="588,1433,286,247" />
<Overlay Id="JIdH46FAnhZQMplYQlEJ9T" Name="" Bounds="588,1433,286,278" />
<Pad Id="J3ANwWEYzFLMfrFYz5H0w8" Bounds="595,1458,248,36" ShowValueBox="true" isIOBox="true" Value="In vvvv these concepts enable runtime type flexibility">
<p:TypeAnnotation LastCategoryFullName="Primitive" LastDependency="VL.CoreLib.vl">
<Choice Kind="TypeFlag" Name="String" />
Expand All @@ -110,8 +110,8 @@
<p:stringtype p:Assembly="VL.Core" p:Type="VL.Core.StringType">Comment</p:stringtype>
</p:ValueBoxSettings>
</Pad>
<Overlay Id="EnxOVPmFygkPIuU9npCldT" Name="" Bounds="604,667,275,515" />
<Pad Id="LHpwoQlWPnAN2US2gHB7PC" Bounds="603,684,263,478" ShowValueBox="true" isIOBox="true" Value="Run-time type flexibility allows live objects to be treated as multiple types.&#xD;&#xA;&#xD;&#xA;Generally run-time type flexibility enables novel software patterns and function design that would be very difficult to achieve another way. &#xD;&#xA;&#xD;&#xA;Advantages&#xD;&#xA;-Depends on usecase but typically enables dynamic run-time behaviour based on object type. EG select an object in a CAD app and then draw the relevant edit widgets for that type onscreen. &#xD;&#xA;&#xD;&#xA;&#xD;&#xA;Disadvantages&#xD;&#xA;-Potential performance impact from run-time checking of type safety&#xD;&#xA;-Possible run-time exceptions on failed type conversions&#xD;&#xA;-Potentially more confusing and ambigious code &#xD;&#xA;-Often means less useful tool-tips showing live values&#xD;&#xA;&#xD;&#xA;">
<Overlay Id="EnxOVPmFygkPIuU9npCldT" Name="" Bounds="604,667,273,539" />
<Pad Id="LHpwoQlWPnAN2US2gHB7PC" Bounds="603,684,261,514" ShowValueBox="true" isIOBox="true" Value="Run-time type flexibility allows live objects to be treated as multiple types.&#xD;&#xA;&#xD;&#xA;Generally run-time type flexibility enables novel software patterns and function design that would be very difficult to achieve another way. &#xD;&#xA;&#xD;&#xA;Advantages&#xD;&#xA;-Depends on usecase but typically enables dynamic run-time behaviour based on object type. EG select an object in a CAD app and then draw the relevant edit widgets for that object type &#xD;&#xA;&#xD;&#xA;Disadvantages&#xD;&#xA;-Potential performance impact from conversions&#xD;&#xA;-Potential performance impact from run-time checking of type safety&#xD;&#xA;-Possible run-time exceptions on failed type conversions&#xD;&#xA;-Potentially more confusing and ambigious code &#xD;&#xA;-Can mean less useful tool-tips showing live values&#xD;&#xA;&#xD;&#xA;">
<p:TypeAnnotation LastCategoryFullName="Primitive" LastDependency="VL.CoreLib.vl">
<Choice Kind="TypeFlag" Name="String" />
</p:TypeAnnotation>
Expand All @@ -120,7 +120,7 @@
<p:stringtype p:Assembly="VL.Core" p:Type="VL.Core.StringType">Comment</p:stringtype>
</p:ValueBoxSettings>
</Pad>
<Pad Id="K5T7OrPpejVLVa4FhUDrjm" Bounds="631,1556,147,35" ShowValueBox="true" isIOBox="true" Value="Casting">
<Pad Id="K5T7OrPpejVLVa4FhUDrjm" Bounds="630,1624,147,35" ShowValueBox="true" isIOBox="true" Value="Casting">
<p:TypeAnnotation LastCategoryFullName="Primitive" LastDependency="VL.CoreLib.vl">
<Choice Kind="TypeFlag" Name="String" />
</p:TypeAnnotation>
Expand All @@ -129,7 +129,7 @@
<p:stringtype p:Assembly="VL.Core" p:Type="VL.Core.StringType">Comment</p:stringtype>
</p:ValueBoxSettings>
</Pad>
<Pad Id="VHLLBtkogG6O5VpSeMYQKJ" Bounds="629,1596,147,35" ShowValueBox="true" isIOBox="true" Value="Interfaces">
<Pad Id="VHLLBtkogG6O5VpSeMYQKJ" Bounds="628,1664,147,35" ShowValueBox="true" isIOBox="true" Value="Interfaces">
<p:TypeAnnotation LastCategoryFullName="Primitive" LastDependency="VL.CoreLib.vl">
<Choice Kind="TypeFlag" Name="String" />
</p:TypeAnnotation>
Expand All @@ -138,7 +138,7 @@
<p:stringtype p:Assembly="VL.Core" p:Type="VL.Core.StringType">Comment</p:stringtype>
</p:ValueBoxSettings>
</Pad>
<Pad Id="K3u2lvhZykbMqoagrBiW7z" Bounds="632,1517,188,29" ShowValueBox="true" isIOBox="true" Value="Implicit Conversion">
<Pad Id="K3u2lvhZykbMqoagrBiW7z" Bounds="629,1551,188,29" ShowValueBox="true" isIOBox="true" Value="Implicit Conversion">
<p:TypeAnnotation LastCategoryFullName="Primitive" LastDependency="VL.CoreLib.vl">
<Choice Kind="TypeFlag" Name="String" />
</p:TypeAnnotation>
Expand All @@ -147,39 +147,7 @@
<p:stringtype p:Assembly="VL.Core" p:Type="VL.Core.StringType">Comment</p:stringtype>
</p:ValueBoxSettings>
</Pad>
<Pad Id="Op5oy32MQirNC0B17DnavV" Bounds="1014,1376,35,15" ShowValueBox="true" isIOBox="true" Value="0">
<p:TypeAnnotation LastCategoryFullName="Primitive" LastDependency="VL.CoreLib.vl">
<Choice Kind="ImmutableTypeFlag" Name="Float32" />
</p:TypeAnnotation>
</Pad>
<Pad Id="RZJb9GSJgD9OUv6lASAjBO" Bounds="1025,1436,79,16" ShowValueBox="true" isIOBox="true" Value="32000">
<p:TypeAnnotation LastCategoryFullName="Primitive" LastDependency="VL.CoreLib.vl">
<Choice Kind="ImmutableTypeFlag" Name="Integer32" />
</p:TypeAnnotation>
</Pad>
<Pad Id="OHc9l8sdVs2M4Sx6XQUEUO" Bounds="1029,1483,116,15" ShowValueBox="true" isIOBox="true" Value="0">
<p:TypeAnnotation LastCategoryFullName="Primitive" LastDependency="VL.CoreLib.vl">
<Choice Kind="ImmutableTypeFlag" Name="Float32" />
</p:TypeAnnotation>
</Pad>
<Node Bounds="1082,1357,60,19" Id="SuUJyvUMlHBOuagu0jV6Tm">
<p:NodeReference LastCategoryFullName="Primitive.Integer32" LastDependency="VL.CoreLib.vl">
<Choice Kind="NodeFlag" Name="Node" Fixed="true" />
<CategoryReference Kind="Int32Type" Name="Integer32" />
<Choice Kind="OperationCallFlag" Name="MaxValue" />
</p:NodeReference>
<Pin Id="EiWUFi1oJMkOdtDUfihSye" Name="Max Value" Kind="OutputPin" />
</Node>
<Node Bounds="1103,1396,25,19" Id="GHzV2fPseAjLxIO3dinALT">
<p:NodeReference LastCategoryFullName="Math" LastDependency="VL.CoreLib.vl">
<Choice Kind="NodeFlag" Name="Node" Fixed="true" />
<Choice Kind="OperationCallFlag" Name="-" />
</p:NodeReference>
<Pin Id="CoOOEt0EV3kO4X9HlzEGHK" Name="Input" Kind="InputPin" />
<Pin Id="JBc86aNwUBjMIOwecF1EaR" Name="Input 2" Kind="InputPin" DefaultValue="15250" />
<Pin Id="Mwtb62AxLq5MAMnDIWUcos" Name="Output" Kind="OutputPin" />
</Node>
<Pad Id="LB47H3g6FTNQAdXQzY2ZgU" Bounds="1142,1423,285,71" ShowValueBox="true" isIOBox="true" Value="&lt;&lt;Note implicit conversion can cause problems, like with very high ints to floats. It's not actually perfectly safe">
<Pad Id="EWdxbKGuIygMQrNRBnA1fA" Bounds="271,77,571,257" ShowValueBox="true" isIOBox="true" Value="Typically when this topic is taught, it's split into COMPILE-TIME and RUN-TIME type CHECKING.&#xD;&#xA;This is a useful organisation because it focuses on when the CHECKING for TYPE SAFETY is done, as that can affect performance.&#xD;&#xA;&#xD;&#xA;But I've chosen to do something a bit different. &#xD;&#xA;I've chosen to teach it a different way and split into PROGRAMMING-TIME and RUN-TIME type FLEXIBILITY. &#xD;&#xA;This is because&#xD;&#xA;A) vvvv editor is always compiling code as soon as it can, to enable the live programming paradigm. This makes it a little confusing to think about COMPILE-TIME.&#xD;&#xA;B) Organising it this way brings the different USECASES into focus, IE when it's useful to have TYPE FLEXIBILITY, rather than when the TYPE SAFE CHECKING is done. &#xD;&#xA;I will mention the potential performance implications as we go through each case.">
<p:TypeAnnotation LastCategoryFullName="Primitive" LastDependency="VL.CoreLib.vl">
<Choice Kind="TypeFlag" Name="String" />
</p:TypeAnnotation>
Expand All @@ -188,7 +156,8 @@
<p:stringtype p:Assembly="VL.Core" p:Type="VL.Core.StringType">Comment</p:stringtype>
</p:ValueBoxSettings>
</Pad>
<Pad Id="Dqz20Oi59LSNgMWdNxUalP" Bounds="1143,1489,285,71" ShowValueBox="true" isIOBox="true" Value="cover also the UI side of it where you occasionally need to give some hints to force it, like if I wanted to put a + between the int and float32 here could give me the wrong one">
<Overlay Id="AQncIyEdhwKMBFZJa78kIZ" Name="Note" Bounds="266,32,603,288" />
<Pad Id="HaED9RtSc5kNNPaEQJPFNq" Bounds="494,647,173,19" ShowValueBox="true" isIOBox="true" Value="Descriptions and usecase">
<p:TypeAnnotation LastCategoryFullName="Primitive" LastDependency="VL.CoreLib.vl">
<Choice Kind="TypeFlag" Name="String" />
</p:TypeAnnotation>
Expand All @@ -197,35 +166,31 @@
<p:stringtype p:Assembly="VL.Core" p:Type="VL.Core.StringType">Comment</p:stringtype>
</p:ValueBoxSettings>
</Pad>
<Pad Id="EWdxbKGuIygMQrNRBnA1fA" Bounds="276,75,571,234" ShowValueBox="true" isIOBox="true" Value="Typically when this topic is taught, it's split into COMPILE-TIME and RUN-TIME type CHECKING.&#xD;&#xA;This is a useful organisation because it focuses on when the CHECKING for TYPE SAFETY is done, as that can affect performance.&#xD;&#xA;&#xD;&#xA;I've chosen to teach it a different way and split into PROGRAMMING-TIME and RUN-TIME type FLEXIBILITY. &#xD;&#xA;This is because&#xD;&#xA;A) vvvv editor is always compiling code as soon as it can to enable the live programming paradigm. This makes it a little confusing to think about COMPILE-TIME.&#xD;&#xA;B) Organising it this way brings the different USECASES into focus, IE when it's useful to have TYPE FLEXIBILITY, rather than when the TYPE SAFE CHECKING is done. &#xD;&#xA;I will mention the potential performance implications as we go through each case.">
<Pad Id="Sqm0sC4mvGNOfD2bPgqBS5" Bounds="629,1516,188,29" ShowValueBox="true" isIOBox="true" Value="Explicit Conversion">
<p:TypeAnnotation LastCategoryFullName="Primitive" LastDependency="VL.CoreLib.vl">
<Choice Kind="TypeFlag" Name="String" />
</p:TypeAnnotation>
<p:ValueBoxSettings>
<p:fontsize p:Type="Int32">9</p:fontsize>
<p:fontsize p:Type="Int32">14</p:fontsize>
<p:stringtype p:Assembly="VL.Core" p:Type="VL.Core.StringType">Comment</p:stringtype>
</p:ValueBoxSettings>
</Pad>
<Overlay Id="AQncIyEdhwKMBFZJa78kIZ" Name="Note" Bounds="272,32,603,288" />
<Pad Id="HaED9RtSc5kNNPaEQJPFNq" Bounds="494,647,173,19" ShowValueBox="true" isIOBox="true" Value="Descriptions and usecase">
<Pad Id="QG1PNeavTgaP2qQ0JZfzB2" Bounds="631,1587,147,35" ShowValueBox="true" isIOBox="true" Value="Inheritance">
<p:TypeAnnotation LastCategoryFullName="Primitive" LastDependency="VL.CoreLib.vl">
<Choice Kind="TypeFlag" Name="String" />
</p:TypeAnnotation>
<p:ValueBoxSettings>
<p:fontsize p:Type="Int32">9</p:fontsize>
<p:fontsize p:Type="Int32">14</p:fontsize>
<p:stringtype p:Assembly="VL.Core" p:Type="VL.Core.StringType">Comment</p:stringtype>
</p:ValueBoxSettings>
</Pad>
</Canvas>
<Patch Id="DXbf1VX5U6rQAkiqjaENrs" Name="Create" />
<Patch Id="FEPhBjRqQkwM0FH21yuFV8" Name="Update" ParticipatingElements="GsDGNRztVUxNEIudAZb91n" />
<Patch Id="FEPhBjRqQkwM0FH21yuFV8" Name="Update" />
<ProcessDefinition Id="BALR4Ygwaw5M1jGaSyVLAV">
<Fragment Id="DmU10DT5qheMnOXEPv6M6J" Patch="DXbf1VX5U6rQAkiqjaENrs" Enabled="true" />
<Fragment Id="S3m73OOJzafO2CLNXI2AOI" Patch="FEPhBjRqQkwM0FH21yuFV8" Enabled="true" />
</ProcessDefinition>
<Link Id="GsDGNRztVUxNEIudAZb91n" Ids="RZJb9GSJgD9OUv6lASAjBO,OHc9l8sdVs2M4Sx6XQUEUO" />
<Link Id="VkQv970TFp2MgY5NjU6ve1" Ids="EiWUFi1oJMkOdtDUfihSye,CoOOEt0EV3kO4X9HlzEGHK" />
<Link Id="LYNMF5R8BD8Mqu0ksQzi48" Ids="Mwtb62AxLq5MAMnDIWUcos,RZJb9GSJgD9OUv6lASAjBO" />
</Patch>
</Node>
</Patch>
Expand Down
Loading

0 comments on commit 49f2da5

Please sign in to comment.