Skip to content

Commit 5ee4706

Browse files
committed
fixed typos
1 parent bf2045c commit 5ee4706

File tree

1 file changed

+36
-28
lines changed

1 file changed

+36
-28
lines changed

features/rfc-oop-constructors.rst

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ Note that by-copy constructor are also called in assignments situations
145145
begin
146146
V1 := V2; -- calls destructor on V1, then copy from V2.
147147
148-
A non-limited type always have a by constructor copy available, overloaded or
148+
A non-limited type always has a by-copy constructor available, overloaded or
149149
not.
150150

151151
Super Constructor Call
@@ -188,8 +188,8 @@ Note that the constructor of an abstract type can be called here, for example:
188188
null;
189189
end Child'Constructor;
190190
191-
When valuating values in the Super aspect, the constructed object does not
192-
exit yet. It is illegal to refer to this parameter in the aspect.
191+
When valuating values in the Super aspect, the object under construction does
192+
not exit yet. It is illegal to refer to its parameter in the aspect.
193193

194194
Initialization Lists
195195
--------------------
@@ -210,7 +210,7 @@ Initialization of components can be done in two ways:
210210
- Through an ``Initialize`` aspect that can rely on constructor parameters.
211211

212212
If the component is of a type that doesn't have a parameterless constructor, it
213-
has to be initialized by on of these two mechanism.
213+
has to be initialized by one of these two mechanism.
214214

215215
Here's an example of using ``Initialize`` for such a case:
216216

@@ -280,7 +280,7 @@ initialized as described at declaration time. For example:
280280
end C'Constructor;
281281
282282
V1 : C := C'Make; -- Will print A FROM RECORD, B FROM RECORD
283-
V2 : C := C'Make ("ATERNATE A"); -- Will print ATERNATE A, B FROM RECORD
283+
V2 : C := C'Make ("ALTERNATE A"); -- Will print ALTERNATE A, B FROM RECORD
284284
285285
Note for implementers - the objective of the semantic above is to make
286286
initialization as efficient as possible and to avoid undecessary processing.
@@ -322,7 +322,7 @@ object. The following for example will issue an error:
322322
end record;
323323
324324
type Child is new Root with record
325-
C : R;
325+
C : Integer;
326326
end record;
327327
328328
procedure Child'Constructor (Self : in out Child);
@@ -338,9 +338,9 @@ object. The following for example will issue an error:
338338
null;
339339
end Child'Constructor;
340340
341-
When valuating values in the Initialize aspect, the constructed object does not
342-
exit yet. It is illegal to refer to this parameter in the aspect. The following
343-
is illegal:
341+
When valuating values in the Initialize aspect, the object under construction
342+
does not exist yet. It is illegal to refer to this parameter in the aspect.
343+
The following is illegal:
344344

345345
.. code-block:: ada
346346
@@ -413,7 +413,7 @@ constructors, the parent type discriminants are not set. For example:
413413
414414
type Root (V : Integer) is tagged null record;
415415
416-
procedure Root'Constructor (Self : in out Child);
416+
procedure Root'Constructor (Self : in out Root);
417417
418418
-- note that we're not specifying Root discriminant as Root has a constructor
419419
type Child is new Root with null record;
@@ -523,7 +523,7 @@ such subtyping can also be used for components:
523523
end record;
524524
525525
In this version of the proposal, discriminant subtyping is only legal for
526-
untagged types. Considerations around type types are described in the future
526+
untagged types. Considerations around tagged types are described in the future
527527
possibilities section.
528528

529529
Constructors and Type Predicates
@@ -578,32 +578,40 @@ constructors are declared. Notably:
578578
- Requirement on parameterless and by copy constructors can be removed by
579579
marking them abstract.
580580

581-
As for subsprograms, generic formal constructors are introduced with the `with`
581+
As for subprograms, generic formal constructors are introduced with the `with`
582582
reserved word. For example:
583583

584584
.. code-block:: ada
585585
586586
generic
587587
type T1 is tagged private;
588-
-- Needs at least a parameterless and a by-copy constructor
588+
-- Needs at least a parameterless and a by-copy constructor,
589+
-- if T1 is by constructor.
589590
590591
type T2 is tagged private;
591592
with T2'Constructor (Self : in out T2; V : Integer);
592593
-- No parameterless constructor expected, but a by-copy one
593594
594595
type T3 is tagged private;
595-
with T2'Constructor (Self : in out T2) is abstract;
596+
with T3'Constructor (Self : in out T3) is abstract;
596597
-- No parameterless constructor expected, but a by-copy one
597598
598599
type T4 is tagged private;
599-
with T4'Constructor (Self : in out T2) is abstract;
600-
with T4'Constructor (Self : in out T2; Src : T2) is abstract;
601-
-- No parameterless constructor expected, but a by-copy one
600+
with T4'Constructor (Self : in out T4) is abstract;
601+
with T4'Constructor (Self : in out T4; Src : T4) is abstract;
602+
-- Neither parameterless nor by-copy constructor expected
602603
package G is
603-
V : T1; -- OK, we have parameterless constructor
604-
V2 : T1 := V; -- OK, we have by-copy constructor
604+
V11: T1; -- OK, we have parameterless constructor for T1
605+
V12: T1 := V11; -- OK, we have by-copy constructor for T1
606+
607+
V21: T2; -- NOK, no parameterless constructor expected for T2
608+
V22: T2 := V21; -- OK, we have by-copy constructor for T2
605609
606-
V3 : T4; -- NOK we don't have parameterless constructor for T4
610+
V31: T3; -- NOK, no parameterless constructor expected for T3
611+
V32: T3 := V31; -- OK, we have by-copy constructor for T3
612+
613+
V41: T4; -- NOK we don't have parameterless constructor for T4
614+
V42: T4 := V41; -- NOK we don't have by-copy constructor for T4
607615
end G;
608616
609617
package P is
@@ -625,9 +633,9 @@ reserved word. For example:
625633
-- All of these are OK, T1 provides all the necessary constructors
626634
627635
package G2 is new G (
628-
T1 => R2, -- Error, R2 doesn't have parametelress and by copy constructor
629-
T2 => R2, -- Error, R2 doesn't have parametric and by copy constructor
630-
T3 => R2, -- Error, R2 doesn't by copy constructor
636+
T1 => R2, -- Error, R2 doesn't have parameterless and by-copy constructor
637+
T2 => R2, -- Error, R2 doesn't have parametric and by-copy constructor
638+
T3 => R2, -- Error, R2 doesn't have by-copy constructor
631639
T4 => R2 -- OK, no constructor expected here
632640
);
633641
@@ -683,7 +691,7 @@ type by a "by constructor" tagged type, e.g.:
683691
684692
procedure New_Child'Constructor (Self : in out New_Child; L1, L2 : Integer);
685693
686-
In that case, any child of New_Child has to be a by-constructor type, ie it
694+
In that case, any child of New_Child has to be a by-constructor type, i.e.
687695
while it is possible to extend a "regular" tagged type by a "by constructor"
688696
tagged type, it is not possible to extend a "by constructor" tagged type by
689697
a regular one.
@@ -695,7 +703,7 @@ In certain situations, it's important to know if an object is considered
695703
initialized. For example, this can clarify wether passing a value of such object
696704
may lead to errors.
697705

698-
An object value in a constructor is consisered initialized once the `Super` and
706+
An object value in a constructor is considered initialized once the `Super` and
699707
`Initialze` aspects have been computed. Formally, the role of the constructor
700708
is to establish further properties than the initialization.
701709

@@ -729,7 +737,7 @@ operation. The discriminants may need to be valuated, the super constructor
729737
must be called. In some cases, the object memory is already allocated (think
730738
of the case of a component with an implicit constructor call).
731739

732-
Having a constructor as a procedure also allows for expansion without undecessary
740+
Having a constructor as a procedure also allows for expansion without unnecessary
733741
copies:
734742

735743
.. code-block:: ada
@@ -893,15 +901,15 @@ Consider the following hierarchy:
893901
null;
894902
end Root'Constructor;
895903
896-
type Child is new Root with null record with Constructor => Constr;
904+
type Child is new Root with null record;
897905
898906
procedure Child'Constructor (Self : in out Bla; C : Boolean)
899907
with Super => (C);
900908
is
901909
null;
902910
end Child'Constructor;
903911
904-
Child does not have any discrimininant. Root discriminant is set by its own
912+
Child does not have any discriminant. Root discriminant is set by its own
905913
constructor. There is currently no syntax allowing to subtype Child and provide
906914
a constrain to its discriminant.
907915

0 commit comments

Comments
 (0)