On Fri, 4 Apr 2008 08:16:04 -0700 (PDT), Graham wrote:
> I haven't been using Ada for all that long, but I have been thinking
> that a kinder, gentler version would be nice in some cir***stances.
> Not necessarily *no* type-checking, but the ability to mix, say,
> integers, fixed-point types and floats in an equation without
> cluttering up the code with conversions.
But you can do that. Provided you knew the semantics of Integer + Float
your hands are free. Define
function "+" (Left : Integer; Right : Float) return Float;
Here you are.
The compiler does not define it for you for just one reason. The semantics
of this operation cannot be universally defined. Integers and Floats have
contradicting algebraic properties. + is exact for the former and inexact
for the latter. Therefore if adding them makes sense, that is specific for
the application which gives an interpretation to Integer and Float in some
way. In other words it is your business.
> I dare say that you wouldn't want to program a missile in such a loose
> way, but for the kinds of things I'm involved in - financial apps and
> simulations - the level of strictness of Ada would be a turn-off for
> many developers.
This puzzles me. Do not financial applications have quite strict
requirements imposed numeric behavior? Or are you writing for Bear
Stearns?
(:-))
> Sorting out string handling out would be nice, too.
What do you mean? In fact Ada's fixed strings handling is the best I know.
You should never need Unbounded_String except for rare cases, when you
wanted to return two strings out of one function.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


|