Skip to content

Commit 68dde36

Browse files
Merge branch 'slides/131-replace-field_with_component' into 'master'
Resolve "Replace 'field' used in the slides with "component"" See merge request feng/training/material!294
2 parents aece7ca + 49459b5 commit 68dde36

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+183
-183
lines changed

courses/fundamentals_of_ada/030_basic_types/01-introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Categories of Types
114114
Scalar Types
115115
--------------
116116

117-
* Indivisible: No components
117+
* Indivisible: No :dfn:`components` (also known as *fields* or *elements*)
118118
* **Relational** operators defined (``<``, ``=``, ...)
119119

120120
- **Ordered**

courses/fundamentals_of_ada/060_record_types/01-introduction.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Syntax and Examples
2222
.. code:: Ada
2323
2424
type Record1_T is record
25-
Field1 : Integer;
26-
Field2 : Boolean;
25+
Component1 : Integer;
26+
Component2 : Boolean;
2727
end record;
2828
2929
* Records can be **discriminated** as well

courses/fundamentals_of_ada/060_record_types/04-aggregates.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ Quiz
249249
.. code:: Ada
250250
251251
type Nested_T is record
252-
Field : Integer;
252+
Component : Integer;
253253
end record;
254254
type Record_T is record
255255
One : Integer;

courses/fundamentals_of_ada/060_record_types/06-variant_records.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Immutable Variant Record
3232
type Person_Group is (Student, Faculty);
3333
type Person (Group : Person_Group) is
3434
record
35-
-- Fields common across all discriminants
35+
-- Components common across all discriminants
3636
-- (must appear before variant part)
3737
Age : Positive;
3838
case Group is -- Variant part of record
@@ -46,11 +46,11 @@ Immutable Variant Record
4646
* In a variant record, a discriminant can be used to specify the :dfn:`variant part` (line 8)
4747

4848
+ Similar to case statements (all values must be covered)
49-
+ Fields listed will only be visible if choice matches discriminant
50-
+ Field names need to be unique (even across discriminants)
49+
+ Components listed will only be visible if choice matches discriminant
50+
+ Component names need to be unique (even across discriminants)
5151
+ Variant part must be end of record (hence only one variant part allowed)
5252

53-
* Discriminant is treated as any other field
53+
* Discriminant is treated as any other component
5454

5555
* But is a constant in an immutable variant record
5656

@@ -60,7 +60,7 @@ Immutable Variant Record
6060
Immutable Variant Record Example
6161
----------------------------------
6262

63-
* Each object of :ada:`Person` has three fields, but it depends on :ada:`Group`
63+
* Each object of :ada:`Person` has three components, but it depends on :ada:`Group`
6464

6565
.. code:: Ada
6666
@@ -69,7 +69,7 @@ Immutable Variant Record Example
6969
7070
* :ada:`Pat` has :ada:`Group`, :ada:`Age`, and :ada:`Gpa`
7171
* :ada:`Sam` has :ada:`Group`, :ada:`Age`, and :ada:`Pubs`
72-
* Aggregate specifies all fields, including the discriminant
72+
* Aggregate specifies all components, including the discriminant
7373

7474
* Compiler can detect some problems, but more often clashes are run-time errors
7575

@@ -121,7 +121,7 @@ Mutable Variant Record
121121
Mutable Variant Record Example
122122
--------------------------------
123123

124-
* Each object of :ada:`Person` has three fields, but it depends on :ada:`Group`
124+
* Each object of :ada:`Person` has three components, but it depends on :ada:`Group`
125125

126126
.. code:: Ada
127127

courses/fundamentals_of_ada/065_discriminated_records/01-introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Defining a Discriminated Record
3131

3232
* **Discriminant** controls behavior of the record
3333
* Part of record definition
34-
* Can be read as any other field
34+
* Can be read as any other component
3535

3636
* But can only be modified by object assignment (sometimes)
3737

courses/fundamentals_of_ada/065_discriminated_records/02-variant_records.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Variant Records
66
What is a Variant Record?
77
---------------------------
88

9-
* A :dfn:`variant record` uses the discriminant to determine which fields are currently accessible
9+
* A :dfn:`variant record` uses the discriminant to determine which components are currently accessible
1010

1111
.. code:: Ada
1212
@@ -133,7 +133,7 @@ Mutable Variant Record Example
133133
end if;
134134
Update (Pat);
135135
136-
* But you cannot change the discriminant like a regular field
136+
* But you cannot change the discriminant like a regular component
137137

138138
.. code:: Ada
139139
@@ -220,7 +220,7 @@ Quiz
220220

221221
.. container:: latex_environment footnotesize
222222

223-
* If you fix the compilation error (by changing the name of one of the :ada:`End_Point` fields), then
223+
* If you fix the compilation error (by changing the name of one of the :ada:`End_Point` components), then
224224

225225
* You would get a warning on line 20 (because :ada:`A_Line` is constrained to be a :ada:`Line`
226226

courses/fundamentals_of_ada/065_discriminated_records/03-discriminant_record_array_size_idiom.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Simple Vector of Varying Length
4444
Obj2 : Simple_Vstring := (0, (others => '+'));
4545
Obj3 : Simple_Vstring;
4646
47-
* Issue - Operations need to consider :ada:`Last` field
47+
* Issue - Operations need to consider :ada:`Last` component
4848

4949
* :ada:`Obj1 = Obj2` will be false
5050
* Can redefine :ada:`=` to be something like

courses/fundamentals_of_ada/065_discriminated_records/04-interfacing_with_c.rst

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Passing Records Between Ada and C
1111
.. code:: C
1212
1313
struct Struct_T {
14-
int Field1;
15-
char Field2;
16-
float Field3;
14+
int Component1;
15+
char Component2;
16+
float Component3;
1717
};
1818
1919
int DoSomething (struct Struct_T);
@@ -32,9 +32,9 @@ Building a C-Compatible Record
3232
.. code:: Ada
3333
3434
type Struct_T is record
35-
Field1 : Interfaces.C.int;
36-
Field2 : Interfaces.C.char;
37-
Field3 : Interfaces.C.C_Float;
35+
Component1 : Interfaces.C.int;
36+
Component2 : Interfaces.C.char;
37+
Component3 : Interfaces.C.C_Float;
3838
end record;
3939
4040
* We use types from :ada:`Interfaces.C` to map directly to the C types
@@ -46,9 +46,9 @@ Building a C-Compatible Record
4646
.. code:: Ada
4747
4848
type Struct_T is record
49-
Field1 : Interfaces.C.int;
50-
Field2 : Interfaces.C.char;
51-
Field3 : Interfaces.C.C_Float;
49+
Component1 : Interfaces.C.int;
50+
Component2 : Interfaces.C.char;
51+
Component3 : Interfaces.C.C_Float;
5252
end record with Convention => C_Pass_By_Copy;
5353
5454
-------------------------
@@ -64,9 +64,9 @@ Mapping Ada to C Unions
6464
.. code:: C
6565
6666
union Union_T {
67-
int Field1;
68-
char Field2;
69-
float Field3;
67+
int Component1;
68+
char Component2;
69+
float Component3;
7070
};
7171
7272
* By using a discriminant record and adding aspect :ada:`Unchecked_Union`
@@ -75,9 +75,9 @@ Mapping Ada to C Unions
7575
7676
type C_Union_T (View : natural := 0) is record
7777
case View is
78-
when 0 => Field1 : Interfaces.C.int;
79-
when 1 => Field2 : Interfaces.C.char;
80-
when 2 => Field3 : Interfaces.C.C_Float;
78+
when 0 => Component1 : Interfaces.C.int;
79+
when 1 => Component2 : Interfaces.C.char;
80+
when 2 => Component3 : Interfaces.C.C_Float;
8181
when others => null;
8282
end case;
8383
end record with Convention => C_Pass_By_Copy,
@@ -92,9 +92,9 @@ Quiz
9292
.. code:: C
9393
9494
union Union_T {
95-
struct Record_T field1;
96-
char field2[11];
97-
float field3;
95+
struct Record_T component1;
96+
char component2[11];
97+
float component3;
9898
};
9999
100100
.. code:: Ada

courses/fundamentals_of_ada/065_discriminated_records/99-summary.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Properties of Discriminated Record Types
99
* Rules
1010

1111
- Case choices for variants must partition possible values for discriminant
12-
- Field names must be unique across all variants
12+
- Component names must be unique across all variants
1313

1414
* Style
1515

courses/fundamentals_of_ada/100_packages/03-referencing_other_packages.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ What To Import
9292
with A;
9393
package B is
9494
type Something is record
95-
Field : A.Something;
95+
Component : A.Something;
9696
end record;
9797
end B;
9898
9999
with B; -- no "with" of A
100100
procedure Foo is
101101
X : B.Something;
102102
begin
103-
X.Field := ...
103+
X.Component := ...
104104

0 commit comments

Comments
 (0)