@@ -76,23 +76,27 @@ This presentation focuses on the tools and the thought process.
7676
7777--
7878
79-
8079### Goals of the Function Signature
8180
8281* what is the essence of the function
82+ * easy to use
83+ * hard to get wrong
8384* indicate some non-functional aspects:
8485 * sync/async
8586 * side effects
8687 * error handling indications
8788
8889--
8990
90- ### Audience
91+ ### Communication Context
92+
93+ Goals are served differently in different contexts
9194
92- * new code/maintenance
93- * reading/writing
94- * lib author/user
95+ * is this new code/maintenance
96+ * are you reading/writing
97+ * are you the author/maintainer or the user
9598* finding/learning/using
99+ * new or experienced coder
96100
97101--
98102
@@ -102,8 +106,8 @@ This presentation focuses on the tools and the thought process.
102106 * easy to use => client code clutter
103107 * easy to understand => client code correctness
104108 * easy to learn => reusability
105- * maintainer view
106- * make it easy to adapt => maintainability
109+ * maintainer view: make it
110+ * easy to adapt => maintainability
107111
108112--
109113
@@ -112,8 +116,8 @@ This presentation focuses on the tools and the thought process.
112116Make the essence of the function
113117
114118* as clear as possible
115- * to all needed parties
116- * in all needed situations
119+ * to all parties
120+ * in all situations
117121
118122With the tools we have at our disposal
119123
@@ -123,7 +127,9 @@ With the tools we have at our disposal
123127
124128* types
125129* names
126- * audience interaction
130+ * audience
131+ * interactive?
132+ * communication skills (people... hard!)
127133* (documentation)
128134
129135--
@@ -167,7 +173,8 @@ reuse is not very likely.
167173## Types Convey Meaning
168174
169175* What
170- * type
176+ * underlying type
177+ * argument passing mechanism
171178 * qualifiers
172179* Where
173180 * argument type + qualifiers
@@ -176,47 +183,61 @@ reuse is not very likely.
176183
177184Note: parameters = signature <-> arguments = call+implementation
178185
186+ Note: Hoogle: search by type!
187+
179188--
180189
181190### Type: a Taxonomy
182191
183192* C++
184193 * Built-in
185- * Standard
194+ * Standard Library
186195* Library
187196* Domain <--- probably you need these
188197
189198--
190199
191- ### Vocabulary Types
200+ ### Built-in Types: Metal
201+
202+ For 'metal' representation
192203
193- For expressing a pattern
204+ * wire-format
205+ * storage format
194206
195- * Ownership: `std::unique_ptr`
196- * An error happened: `std::expected<E, T>`
197- * A collection: `vector`, `map`, ...
198- * Decouple timing: `future<T>`, `task<T>`
199- * Decouple iteration: `range`, `iterator`
207+ No "meaning" in your program
208+
209+ --
210+
211+ ### Standard Library Types
212+
213+ "Vocabulary Types" for expressing a pattern
214+
215+ * Examples
216+ * Ownership: `std::unique_ptr`
217+ * Errors: `std::expected<E, T>`
218+ * A collection: `vector`, `map`, ...
219+ * Decouple timing: `future<T>`, `task<T>`
220+ * Decouple iteration: `range`, `iterator`
200221
201222These have counterparts in every language.
202223
203224--
204225
205- ### Stick to the Domain
226+ ### Domain Types (1/3)
206227
207228Why?
208229
209230* maximal compiler error checking
210- * `auto x = get(matrix, 4, 2)` You're screwed.
211- * `auto x = get(matrix, Row{2}, Col{4})`
231+ * `get(matrix, 4, 2)` You're screwed.
232+ * `get(matrix, Row{2}, Col{4})`
212233* little (textual!) overhead, no run-time overhead
213234* cohesion
214- * `pump::state what_if(pump, event)`
215- * `int what_if(pump, char )`
235+ * `char what_if(pump, char)` (bad)
236+ * `state what_if(pump, event )`
216237
217238--
218239
219- ### Domain Types (1/2 )
240+ ### Domain Types (2/3 )
220241
221242AKA Semantic/Meaningful/Strong types
222243
@@ -245,19 +266,15 @@ Ah... Ok.
245266
246267--
247268
248- ### Domain Types (2/2 )
269+ ### Domain Types (3/3 )
249270
250271Advice: build domain types
251272
252- * however small; they'll help later!
253- * built-ins are for
254- * storage
255- * utter performance
256- * platform dependencies
257- * adapting to foreing functions
258- * domain types are for
259- * meaning
260-
273+ * Decoupling
274+ * Allow the representation to change
275+ * Cross-language
276+ * However small; they'll help later!
277+ * [P.1 Ideas in Code](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rp-direct)
261278
262279--
263280
0 commit comments