On Mon, 21 Apr 2008 09:35:36 -0700 (PDT), Eric Hughes wrote:
> ARM 2.4.1 "Decimal Literals"
> has no length limitation on 'numeral'.
Hmm, I don't see it saying this. Do you mean that the syntax rule
specifies
not limit?
If so, we have visited this before, that would not prove your point.
Putting no explicit limit does not require its absence. Consider German
highways, there is no speed limit, alas only at certain places. Should it
mean existence of cars moving faster that light?
It is legal not to compile [some] legal programs.
> On Apr 21, 8:08 am, Robert A Duff <bobd...@[EMAIL PROTECTED]
>
>> Universal_integers can be
>> implicitly converted to various integer types.
>
> This was the whole point of the discussion--why such implicit
> conversions do not break the type system. It's not like integers are
> a tagged type.
I don't see any difference, except that the type tag is not stored in
(more
precisely, cannot be obtained from) the values.
>> type My_Int is range 1..100;
>> Y : constant My_Int := 1 + 1; -- The "+" of My_Int is called.
>> -- Y is of type My_Int.
>
> Are there other places in Ada when the context of an operation
> determines the type of the operands of the function and thus also the
> function signature?
The context does not define the types. It resolves overloaded symbols.
> Context-dependent function selection need not break correctness of a
> program, even when there's ambiguity in what function might be
> selected (non-deterministic execution). The conditions for this to
> work are implicitly present with integer types. I believe it's
> possible to make them explicit for arbitrary types.
The following program:
with Ada.Text_IO; use Ada.Text_IO;
procedure Test_Int is
type My_Int is range 1..100;
function "+" (L, R : My_Int) return My_Int is
begin
return 10;
end "+";
Y : constant My_Int := 1 + 1;
begin
Put_Line (My_Int'Image (Y));
end Test_Int;
illustrates Robert's point. It shall print 10.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


|