Changeset 93d0ed3 for doc/theses/andrew_beach_MMath/features.tex
- Timestamp:
- Aug 12, 2021, 8:46:58 AM (2 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- c9f9d4f
- Parents:
- bfd7b30
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/andrew_beach_MMath/features.tex
rbfd7b30 r93d0ed3 165 165 % The root type has no ancestors. 166 166 % A type's descendants are its children and its children's descendants. 167 Every virtual type also has a pointer to a virtual table with list of virtual members. Children inherit 168 their parent's list of virtual members but may add new members to it. 169 For example, 167 Every virtual type (tree node) has a pointer to a virtual table with a unique 168 @Id@ and a list of virtual members (see \autoref{s:VirtualSystem} for 169 details). Children inherit their parent's list of virtual members but may add 170 and/or replace members. For example, 170 171 \begin{cfa} 171 172 vtable W0 | { int ?<?( int, int ); int ?+?( int, int ); } 172 vtable W1 | { int w, int ?==?( int, int );int ?-?( int, int ); }173 vtable W1 | { int ?+?( int, int ); int w, int ?-?( int, int ); } 173 174 \end{cfa} 174 175 creates a virtual table for @W0@ initialized with the matching @<@ and @+@ 175 operations visible at this declaration. Similarly, @W1@ is initialized with 176 @<@ and @+@ from the inheritance with @W0@, plus the @==@ and @-@ operations 177 visible at this declaration. It is important to note that these are virtual 178 members, not virtual methods of object-orientated programming, and can be of 179 any type. 176 operations visible at this declaration context. Similarly, @W1@ is initialized 177 with @<@ from inheritance with @W0@, @+@ is replaced, and @-@ is added, where 178 both operations are matched at this declaration context. It is important to 179 note that these are virtual members, not virtual methods of object-orientated 180 programming, and can be of any type. Finally, trait names can be used to 181 specify the list of virtual members. 180 182 181 183 \PAB{Need to look at these when done. … … 187 189 as if it were a method. 188 190 \todo{Clarify (with an example) virtual methods.} 189 190 Each virtual type has a unique id.191 This id and all the virtual members are combined192 into a virtual table type. Each virtual type has a pointer to a virtual table193 as a hidden field.194 \todo{Might need a diagram for virtual structure.}195 191 }% 196 192
Note: See TracChangeset
for help on using the changeset viewer.