>> Speaking of evil, anonymous types are evil. Why is it hard to declare a >> record type for this purpose? > > A record is mutable, a tuple isn't meant to be mutable > (i.e., can't update it's components). I don't think, supporting function returning ad-hoc anonymous tuples would strengthen Ada's stand as a language well-suited for safe and secure systems. Anonymous types are bad in that area, anyway. If you want tuples, then it would be a lot more consistent to actually propose the introduction of tuples (i.e., constant records) into the Ada type system, e.g., type May_Be_Integer(Valid: Boolean := True) is constant record case Valid is when True => Value: Integer; when False => null; end case; end record; type Numeric(Is_Float: Boolean := True) is constant record case Is_Float is when True => F: Float; when False => I: Integer; end case; end record; Then you can the kind of functions you are requesting: function Calculate(A, B, C: Integer; D, E, F: Float) return Numeric; -- returns either Integer or Float but you can also deal with such tuples in a really consistent way. This could look about as follows: Not_An_Int: May_Be_Integer(False); function May_Be(I: Integer) return May_Be_Integer is (May_Be_Integer(Value => I)); function "+"(A, B: May_Be_Integer) return May_Be_Integer is begin if A.Valid and B.Valid then return A.Value + B.Value; else return Not_An_Int; end; end "+"; function "*"(A, B: May_Be_Integer) return May_Be_Integer is begin if A.Valid and then A.Value = 0 then return 0; elsif B.Valid and then B.Value = 0 then return 0; elsif A.Valid and B.Valid then return A.Value * B.Value else return Not_An_Int; end; end "*"; function "-"(A, B: May_Be_Integer) return May_Be_Integer is ... function "/"(A, B: May_Be_Integer) return May_Be_Integer is ... At a first look, this may appear like a convoluted approach to evaluate integer expressions, replacing exceptions by Not_An_Int. But consider an expression like May_Be(1) + (May_Be(2) / May_Be(0)) * May_Be(0) This expression will evaluate to 1, while the corresponding integer expression 1 + (2/0) * 0 will raise an exception. If there is a chance for errors to cancel out, as in my definition of "*", then integers with error markers are a good approach, and exceptions will complicate things a lot. And yes, I know that my multiplication for May_Be_Integer does not match mathematical conventions. Stefan -------- I love the taste of Cryptanalysis in the morning! -------- www.uni-weimar.de/de/medien/professuren/mediensicherheit/people/stefan-lucks ----Stefan.Lucks (at) uni-weimar.de, Bauhaus-Universität Weimar, Germany----