| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | USING: generic help.markup help.syntax kernel kernel.private | 
					
						
							|  |  |  | namespaces sequences words arrays layouts help effects math | 
					
						
							| 
									
										
										
										
											2008-01-09 04:52:08 -05:00
										 |  |  | layouts classes.private classes compiler.units ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | IN: classes.union | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ARTICLE: "unions" "Union classes" | 
					
						
							| 
									
										
										
										
											2008-05-10 19:09:05 -04:00
										 |  |  | "An object is an instance of a union class if it is an instance of one of its members." | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | { $subsection POSTPONE: UNION: } | 
					
						
							|  |  |  | { $subsection define-union-class } | 
					
						
							|  |  |  | "Union classes can be introspected:" | 
					
						
							|  |  |  | { $subsection members } | 
					
						
							|  |  |  | "The set of union classes is a class:" | 
					
						
							|  |  |  | { $subsection union-class } | 
					
						
							| 
									
										
										
										
											2008-04-03 22:29:49 -04:00
										 |  |  | { $subsection union-class? }  | 
					
						
							| 
									
										
										
										
											2008-05-10 19:09:05 -04:00
										 |  |  | "Unions are used to define behavior shared between a fixed set of classes, as well as to conveniently define predicates." | 
					
						
							| 
									
										
										
										
											2008-04-03 22:29:49 -04:00
										 |  |  | { $see-also "mixins" "tuple-subclassing" } ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | ABOUT: "unions" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | HELP: define-union-class | 
					
						
							|  |  |  | { $values { "class" class } { "members" "a sequence of classes" } } | 
					
						
							| 
									
										
										
										
											2007-12-30 16:09:21 -05:00
										 |  |  | { $description "Defines a union class with specified members. This is the run time equivalent of " { $link POSTPONE: UNION: } "." } | 
					
						
							| 
									
										
										
										
											2007-12-30 15:08:48 -05:00
										 |  |  | { $notes "This word must be called from inside " { $link with-compilation-unit } "." } | 
					
						
							|  |  |  | { $side-effects "class" } ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | { union-class define-union-class POSTPONE: UNION: } related-words | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | HELP: union-class | 
					
						
							|  |  |  | { $class-description "The class of union classes." } ;
 |